Skip to content

Commit

Permalink
Merge pull request #44 from locaal-ai/roy.uno_essentials
Browse files Browse the repository at this point in the history
Add UNO essentials API
  • Loading branch information
royshil authored Nov 7, 2024
2 parents 9610f0f + 828fb34 commit 7b9e27b
Show file tree
Hide file tree
Showing 15 changed files with 351 additions and 274 deletions.
3 changes: 2 additions & 1 deletion scripts/compile_ui.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ Get-ChildItem -Filter src/*.ui | ForEach-Object {
$pyFile = [System.IO.Path]::ChangeExtension($uiFile, ".py")
# add "ui_" prefix to the file name
$pyFile = [System.IO.Path]::Combine($([System.IO.Path]::GetDirectoryName($pyFile)), "ui_$([System.IO.Path]::GetFileName($pyFile))")
pyside6-uic $uiFile -o $pyFile
pyside6-uic $uiFile -o $pyFile -p -n --no-qt-namespace --star-imports
Write-Host "Processed $UiFile -> $pyFile"
}
315 changes: 193 additions & 122 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1375,130 +1375,201 @@
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="connectionWidget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_29">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="connectionLabel_2">
<property name="text">
<string>URL</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_unoUrl">
<property name="text">
<string>https://app.overlays.uno/apiv2/controlapps/.../api</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_toggleUno">
<property name="text">
<string>▶️</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_26" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_30">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
<widget class="QWidget" name="widget_uno_props" native="true">
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="connectionWidget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_29">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="connectionLabel_2">
<property name="text">
<string>URL</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_unoUrl">
<property name="text">
<string>https://app.overlays.uno/apiv2/controlapps/.../api</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_toggleUno">
<property name="text">
<string>▶️</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_26" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<item>
<widget class="QCheckBox" name="checkBox_uno_send_same">
<property name="toolTip">
<string>Send only new detections or also existing?</string>
</property>
<property name="text">
<string>Send Same?</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_23">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Rate Limit</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>/second</string>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<layout class="QHBoxLayout" name="horizontalLayout_30">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QCheckBox" name="checkBox_uno_send_same">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Send only new detections or also existing?</string>
</property>
<property name="text">
<string>Send Same?</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_uno_essentials">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Essentials</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_23">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Rate Limit</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>/sec</string>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_uno_essentials_details" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_21">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_24">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Overlay ID</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_uno_essentials_id">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>aaaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QTableView" name="tableView_unoMapping">
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
Expand Down
4 changes: 2 additions & 2 deletions src/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ def edit_item(self, item_name: str, new_item: TextDetectionTarget):
self._data[i].settings = new_item.settings
self.data_changed.emit(self._data)
return
logger.warn("unable to find item to edit in storage: " + item_name)
logger.warning("unable to find item to edit in storage: " + item_name)

def rename_item(self, old_name: str, new_name: str):
for i, item in enumerate(self._data):
if item.name == old_name:
self._data[i].name = new_name
self.data_changed.emit(self._data)
return True
logger.warn("unable to find item to rename in storage: " + old_name)
logger.warning("unable to find item to rename in storage: " + old_name)
return False

def get_data(self):
Expand Down
Loading

0 comments on commit 7b9e27b

Please sign in to comment.