mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
When passing in a filename, autoselect that document
This commit is contained in:
parent
c9e32ef82d
commit
85644ad097
4 changed files with 10 additions and 8 deletions
|
@ -25,6 +25,9 @@ def main(filename):
|
|||
# Common object
|
||||
common = Common()
|
||||
|
||||
# Main window
|
||||
main_window = MainWindow(app, common)
|
||||
|
||||
if filename != "":
|
||||
# Validate filename
|
||||
filename = os.path.abspath(os.path.expanduser(filename))
|
||||
|
@ -37,7 +40,6 @@ def main(filename):
|
|||
print("Permission denied")
|
||||
return
|
||||
common.set_document_filename(filename)
|
||||
main_window.doc_selection_widget.document_selected.emit()
|
||||
|
||||
# Main window
|
||||
main_window = MainWindow(app, common)
|
||||
sys.exit(app.exec_())
|
||||
|
|
|
@ -2,7 +2,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|||
|
||||
|
||||
class DocSelectionWidget(QtWidgets.QWidget):
|
||||
document_selected = QtCore.pyqtSignal(str)
|
||||
document_selected = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, common):
|
||||
super(DocSelectionWidget, self).__init__()
|
||||
|
@ -38,4 +38,4 @@ class DocSelectionWidget(QtWidgets.QWidget):
|
|||
if filename[0] != "":
|
||||
filename = filename[0]
|
||||
self.common.set_document_filename(filename)
|
||||
self.document_selected.emit(filename)
|
||||
self.document_selected.emit()
|
||||
|
|
|
@ -14,8 +14,8 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||
self.common = common
|
||||
|
||||
self.setWindowTitle("dangerzone")
|
||||
self.setMinimumWidth(500)
|
||||
self.setMinimumHeight(400)
|
||||
self.setMinimumWidth(600)
|
||||
self.setMinimumHeight(350)
|
||||
|
||||
# Header
|
||||
logo = QtWidgets.QLabel()
|
||||
|
@ -63,7 +63,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||
|
||||
self.show()
|
||||
|
||||
def document_selected(self, filename):
|
||||
def document_selected(self):
|
||||
self.doc_selection_widget.hide()
|
||||
self.settings_widget.show()
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ class SettingsWidget(QtWidgets.QWidget):
|
|||
else:
|
||||
self.update_checkbox.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
||||
def document_selected(self, filename):
|
||||
def document_selected(self):
|
||||
# Update the danger doc label
|
||||
self.dangerous_doc_label.setText(
|
||||
f"Dangerous: {os.path.basename(self.common.document_filename)}"
|
||||
|
|
Loading…
Reference in a new issue