Skip to content

Commit

Permalink
Add exit action and new menu for recent files (#1100)
Browse files Browse the repository at this point in the history
  • Loading branch information
jopohl authored Jan 21, 2024
1 parent 8a34513 commit 854a84f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
24 changes: 23 additions & 1 deletion data/ui/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
<x>0</x>
<y>0</y>
<width>798</width>
<height>27</height>
<height>30</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand All @@ -358,13 +358,19 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
</property>
<addaction name="actionSamples_from_csv"/>
</widget>
<widget class="QMenu" name="menuRecent">
<property name="title">
<string>Recent</string>
</property>
</widget>
<addaction name="actionNew_Project"/>
<addaction name="actionProject_settings"/>
<addaction name="actionSave_project"/>
<addaction name="actionClose_project"/>
<addaction name="separator"/>
<addaction name="actionOpen"/>
<addaction name="actionOpen_directory"/>
<addaction name="menuRecent"/>
<addaction name="menuImport"/>
<addaction name="separator"/>
<addaction name="actionSpectrum_Analyzer"/>
Expand All @@ -375,6 +381,8 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
<addaction name="actionCloseAllFiles"/>
<addaction name="separator"/>
<addaction name="actionConvert_Folder_to_Project"/>
<addaction name="separator"/>
<addaction name="actionExit_URH"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
Expand Down Expand Up @@ -822,6 +830,20 @@ image: url(:/icons/icons/splitter_handle_vertical.svg);
<string>100% (disables demodulation)</string>
</property>
</action>
<action name="actionExit_URH">
<property name="icon">
<iconset theme="application-exit">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Exit URH</string>
</property>
</action>
<action name="actionPlaceholder">
<property name="text">
<string>Placeholder</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down
4 changes: 2 additions & 2 deletions src/urh/controller/MainController.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def create_connects(self):
)
self.ui.actionSave_project.triggered.connect(self.save_project)
self.ui.actionClose_project.triggered.connect(self.close_project)
self.ui.actionExit_URH.triggered.connect(self.close)

self.ui.actionAbout_AutomaticHacker.triggered.connect(
self.on_show_about_clicked
Expand Down Expand Up @@ -352,13 +353,12 @@ def create_connects(self):
self.on_label_non_project_mode_link_activated
)

self.ui.menuFile.addSeparator()
for i in range(settings.MAX_RECENT_FILE_NR):
recent_file_action = QAction(self)
recent_file_action.setVisible(False)
recent_file_action.triggered.connect(self.on_open_recent_action_triggered)
self.recentFileActionList.append(recent_file_action)
self.ui.menuFile.addAction(self.recentFileActionList[i])
self.ui.menuRecent.addAction(self.recentFileActionList[i])

def add_plain_bits_from_txt(self, filename: str):
with open(filename) as f:
Expand Down
16 changes: 15 additions & 1 deletion src/urh/ui/ui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,16 @@ def setupUi(self, MainWindow):
self.verticalLayout_4.setStretch(1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 798, 27))
self.menubar.setGeometry(QtCore.QRect(0, 0, 798, 30))
self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile")
self.menuImport = QtWidgets.QMenu(self.menuFile)
icon = QtGui.QIcon.fromTheme("document-import")
self.menuImport.setIcon(icon)
self.menuImport.setObjectName("menuImport")
self.menuRecent = QtWidgets.QMenu(self.menuFile)
self.menuRecent.setObjectName("menuRecent")
self.menuEdit = QtWidgets.QMenu(self.menubar)
self.menuEdit.setObjectName("menuEdit")
self.menuDefault_noise_threshold = QtWidgets.QMenu(self.menuEdit)
Expand Down Expand Up @@ -378,6 +380,12 @@ def setupUi(self, MainWindow):
self.action100NoiseThreshold = QtWidgets.QAction(MainWindow)
self.action100NoiseThreshold.setCheckable(True)
self.action100NoiseThreshold.setObjectName("action100NoiseThreshold")
self.actionExit_URH = QtWidgets.QAction(MainWindow)
icon = QtGui.QIcon.fromTheme("application-exit")
self.actionExit_URH.setIcon(icon)
self.actionExit_URH.setObjectName("actionExit_URH")
self.actionPlaceholder = QtWidgets.QAction(MainWindow)
self.actionPlaceholder.setObjectName("actionPlaceholder")
self.menuImport.addAction(self.actionSamples_from_csv)
self.menuFile.addAction(self.actionNew_Project)
self.menuFile.addAction(self.actionProject_settings)
Expand All @@ -386,6 +394,7 @@ def setupUi(self, MainWindow):
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionOpen)
self.menuFile.addAction(self.actionOpen_directory)
self.menuFile.addAction(self.menuRecent.menuAction())
self.menuFile.addAction(self.menuImport.menuAction())
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionSpectrum_Analyzer)
Expand All @@ -396,6 +405,8 @@ def setupUi(self, MainWindow):
self.menuFile.addAction(self.actionCloseAllFiles)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionConvert_Folder_to_Project)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionExit_URH)
self.menuDefault_noise_threshold.addAction(self.actionAutomaticNoiseThreshold)
self.menuDefault_noise_threshold.addAction(self.action1NoiseThreshold)
self.menuDefault_noise_threshold.addAction(self.action5NoiseThreshold)
Expand Down Expand Up @@ -456,6 +467,7 @@ def retranslateUi(self, MainWindow):
)
self.menuFile.setTitle(_translate("MainWindow", "Fi&le"))
self.menuImport.setTitle(_translate("MainWindow", "Import"))
self.menuRecent.setTitle(_translate("MainWindow", "Recent"))
self.menuEdit.setTitle(_translate("MainWindow", "Edi&t"))
self.menuDefault_noise_threshold.setTitle(
_translate("MainWindow", "Default noise threshold")
Expand Down Expand Up @@ -536,6 +548,8 @@ def retranslateUi(self, MainWindow):
self.action100NoiseThreshold.setText(
_translate("MainWindow", "100% (disables demodulation)")
)
self.actionExit_URH.setText(_translate("MainWindow", "Exit URH"))
self.actionPlaceholder.setText(_translate("MainWindow", "Placeholder"))


from urh.ui.views.DirectoryTreeView import DirectoryTreeView
Expand Down

0 comments on commit 854a84f

Please sign in to comment.