Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
matrss committed Apr 29, 2024
1 parent 60bee91 commit 5a65510
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 28 deletions.
22 changes: 11 additions & 11 deletions mslib/msui/mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def __init__(self, parent=None, data_dir=None):
self.ui.serverOptionsCb.currentIndexChanged.connect(self.server_options_handler)

# set up user menu and add to toolbutton
self.user_menu = QtWidgets.QMenu()
self.user_menu = QtWidgets.QMenu(self.ui)
self.profile_action = self.user_menu.addAction("Profile", self.open_profile_window)
self.user_menu.addSeparator()
self.logout_action = self.user_menu.addAction("Logout", self.logout)
Expand Down Expand Up @@ -790,7 +790,7 @@ def open_profile_window(self):
def on_context_menu(point):
self.gravatar_menu.exec_(self.profile_dialog.gravatarLabel.mapToGlobal(point))

self.prof_diag = QtWidgets.QDialog()
self.prof_diag = QtWidgets.QDialog(self.ui)
self.profile_dialog = ui_profile.Ui_ProfileWindow()
self.profile_dialog.setupUi(self.prof_diag)
self.profile_dialog.buttonBox.accepted.connect(lambda: self.prof_diag.close())
Expand All @@ -800,7 +800,7 @@ def on_context_menu(point):
self.profile_dialog.deleteAccountBtn.clicked.connect(self.delete_account)

# add context menu for right click on image
self.gravatar_menu = QtWidgets.QMenu()
self.gravatar_menu = QtWidgets.QMenu(self.ui)
self.gravatar_menu.addAction('Fetch Gravatar', lambda: self.fetch_gravatar(refresh=True))
self.gravatar_menu.addAction('Remove Gravatar', lambda: self.remove_gravatar())
self.profile_dialog.gravatarLabel.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
Expand All @@ -812,7 +812,7 @@ def on_context_menu(point):
def delete_account(self):
# ToDo rename to delete_own_account
if verify_user_token(self.mscolab_server_url, self.token):
w = QtWidgets.QWidget()
w = QtWidgets.QWidget(self.ui)
qm = QtWidgets.QMessageBox
reply = qm.question(w, self.tr('Continue?'),
self.tr("You're about to delete your account. You cannot undo this operation!"),
Expand Down Expand Up @@ -870,7 +870,7 @@ def browse():
self.add_proj_dialog.f_content = file_content
self.add_proj_dialog.selectedFile.setText(file_name)

self.proj_diag = QtWidgets.QDialog()
self.proj_diag = QtWidgets.QDialog(self.ui)
self.add_proj_dialog = add_operation_ui.Ui_addOperationDialog()
self.add_proj_dialog.setupUi(self.proj_diag)
self.add_proj_dialog.f_content = None
Expand All @@ -897,21 +897,21 @@ def add_operation(self):
description = self.add_proj_dialog.description.toPlainText()
category = self.add_proj_dialog.category.text()
if not path:
self.error_dialog = QtWidgets.QErrorMessage()
self.error_dialog = QtWidgets.QErrorMessage(self.ui)
self.error_dialog.showMessage('Path can\'t be empty')
return
elif not description:
self.error_dialog = QtWidgets.QErrorMessage()
self.error_dialog = QtWidgets.QErrorMessage(self.ui)
self.error_dialog.showMessage('Description can\'t be empty')
return
# same regex as for path validation
elif not re.match("^[a-zA-Z0-9_-]*$", category):
self.error_dialog = QtWidgets.QErrorMessage()
self.error_dialog = QtWidgets.QErrorMessage(self.ui)
self.error_dialog.showMessage('Category can\'t contain spaces or special characters')
return
# regex checks if the whole path from beginning to end only contains alphanumerical characters or _ and -
elif not re.match("^[a-zA-Z0-9_-]*$", path):
self.error_dialog = QtWidgets.QErrorMessage()
self.error_dialog = QtWidgets.QErrorMessage(self.ui)
self.error_dialog.showMessage('Path can\'t contain spaces or special characters')
return

Expand Down Expand Up @@ -943,7 +943,7 @@ def add_operation(self):
self.conn.handle_new_operation(op_id)
self.signal_operation_added.emit(op_id, path)
else:
self.error_dialog = QtWidgets.QErrorMessage()
self.error_dialog = QtWidgets.QErrorMessage(self.ui)
self.error_dialog.showMessage('The path already exists')

def get_recent_op_id(self):
Expand Down Expand Up @@ -1134,7 +1134,7 @@ def handle_delete_operation(self):

def handle_leave_operation(self):
logging.debug("handle_leave_operation")
w = QtWidgets.QWidget()
w = QtWidgets.QWidget(self.ui)
qm = QtWidgets.QMessageBox
reply = qm.question(w, self.tr('Mission Support System'),
self.tr("Do you want to leave this operation?"),
Expand Down
2 changes: 1 addition & 1 deletion mslib/msui/mscolab_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def __init__(self, message, chat_window):
else:
self.attachment_path = message["text"]
self.context_menu = QtWidgets.QMenu(self)
self.textArea = QtWidgets.QWidget()
self.textArea = QtWidgets.QWidget(self)
self.replyArea = None
self.replyScroll = QtWidgets.QScrollArea()
self.setup_message_box()
Expand Down
4 changes: 2 additions & 2 deletions mslib/msui/multiple_flightpath_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def select_color(self):
self.list_flighttrack.currentItem().checkState() == QtCore.Qt.Checked):
wp_model = self.list_flighttrack.currentItem().flighttrack_model
if wp_model == self.active_flight_track:
self.error_dialog = QtWidgets.QErrorMessage()
self.error_dialog = QtWidgets.QErrorMessage(self)
self.error_dialog.showMessage('Use "options" to change color of an activated flighttrack.')
else:
color = QtWidgets.QColorDialog.getColor()
Expand Down Expand Up @@ -735,7 +735,7 @@ def select_color(self):
self.list_operation_track.currentItem().checkState() == QtCore.Qt.Checked):
op_id = self.list_operation_track.currentItem().op_id
if self.list_operation_track.currentItem().op_id == self.active_op_id:
self.error_dialog = QtWidgets.QErrorMessage()
self.error_dialog = QtWidgets.QErrorMessage(self)
self.error_dialog.showMessage('Use "options" to change color of an activated operation.')
else:
color = QtWidgets.QColorDialog.getColor()
Expand Down
1 change: 0 additions & 1 deletion mslib/msui/qt5/ui_kmloverlay_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,3 @@ def retranslateUi(self, KMLOverlayDockWidget):
ui.setupUi(KMLOverlayDockWidget)
KMLOverlayDockWidget.show()
sys.exit(app.exec_())

8 changes: 4 additions & 4 deletions mslib/msui/qt5/ui_mscolab_connect_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setupUi(self, MSColabConnectDialog):
self.gridLayout_4.addWidget(self.line, 1, 0, 1, 1)
self.stackedWidget = QtWidgets.QStackedWidget(MSColabConnectDialog)
self.stackedWidget.setObjectName("stackedWidget")
self.loginPage = QtWidgets.QWidget()
self.loginPage = QtWidgets.QWidget(MSColabConnectDialog)
self.loginPage.setObjectName("loginPage")
self.gridLayout_3 = QtWidgets.QGridLayout(self.loginPage)
self.gridLayout_3.setContentsMargins(100, 0, 100, 0)
Expand Down Expand Up @@ -74,7 +74,7 @@ def setupUi(self, MSColabConnectDialog):
self.loginPasswordLe.setObjectName("loginPasswordLe")
self.gridLayout_3.addWidget(self.loginPasswordLe, 2, 0, 1, 2)
self.stackedWidget.addWidget(self.loginPage)
self.newuserPage = QtWidgets.QWidget()
self.newuserPage = QtWidgets.QWidget(MSColabConnectDialog)
self.newuserPage.setObjectName("newuserPage")
self.gridLayout_2 = QtWidgets.QGridLayout(self.newuserPage)
self.gridLayout_2.setContentsMargins(50, 0, 50, 0)
Expand Down Expand Up @@ -118,7 +118,7 @@ def setupUi(self, MSColabConnectDialog):
self.newConfirmPasswordLe.setObjectName("newConfirmPasswordLe")
self.gridLayout_2.addWidget(self.newConfirmPasswordLe, 4, 1, 1, 1)
self.stackedWidget.addWidget(self.newuserPage)
self.httpAuthPage = QtWidgets.QWidget()
self.httpAuthPage = QtWidgets.QWidget(MSColabConnectDialog)
self.httpAuthPage.setObjectName("httpAuthPage")
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.httpAuthPage)
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -147,7 +147,7 @@ def setupUi(self, MSColabConnectDialog):
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_4.addItem(spacerItem)
self.stackedWidget.addWidget(self.httpAuthPage)
self.idpAuthPage = QtWidgets.QWidget()
self.idpAuthPage = QtWidgets.QWidget(MSColabConnectDialog)
self.idpAuthPage.setEnabled(True)
self.idpAuthPage.setObjectName("idpAuthPage")
self.layoutWidget = QtWidgets.QWidget(self.idpAuthPage)
Expand Down
12 changes: 6 additions & 6 deletions mslib/msui/qt5/ui_mscolab_help_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def setupUi(self, mscolabHelpDialog):
self.tabWidget = QtWidgets.QTabWidget(mscolabHelpDialog)
self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)
self.tabWidget.setObjectName("tabWidget")
self.connectingTab = QtWidgets.QWidget()
self.connectingTab = QtWidgets.QWidget(mscolabHelpDialog)
self.connectingTab.setObjectName("connectingTab")
self.gridLayout_4 = QtWidgets.QGridLayout(self.connectingTab)
self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -91,7 +91,7 @@ def setupUi(self, mscolabHelpDialog):
self.verticalLayout_3.setStretch(3, 1)
self.gridLayout_4.addLayout(self.verticalLayout_3, 0, 0, 1, 1)
self.tabWidget.addTab(self.connectingTab, "")
self.createOperationTab = QtWidgets.QWidget()
self.createOperationTab = QtWidgets.QWidget(mscolabHelpDialog)
self.createOperationTab.setObjectName("createOperationTab")
self.gridLayout_3 = QtWidgets.QGridLayout(self.createOperationTab)
self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -119,7 +119,7 @@ def setupUi(self, mscolabHelpDialog):
self.verticalLayout_4.addLayout(self.horizontalLayout_11)
self.gridLayout_3.addLayout(self.verticalLayout_4, 0, 0, 1, 1)
self.tabWidget.addTab(self.createOperationTab, "")
self.adminTab = QtWidgets.QWidget()
self.adminTab = QtWidgets.QWidget(mscolabHelpDialog)
self.adminTab.setObjectName("adminTab")
self.gridLayout_5 = QtWidgets.QGridLayout(self.adminTab)
self.gridLayout_5.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -149,7 +149,7 @@ def setupUi(self, mscolabHelpDialog):
self.verticalLayout_5.addLayout(self.horizontalLayout_12)
self.gridLayout_5.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
self.tabWidget.addTab(self.adminTab, "")
self.chatTab = QtWidgets.QWidget()
self.chatTab = QtWidgets.QWidget(mscolabHelpDialog)
self.chatTab.setObjectName("chatTab")
self.gridLayout_7 = QtWidgets.QGridLayout(self.chatTab)
self.gridLayout_7.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -179,7 +179,7 @@ def setupUi(self, mscolabHelpDialog):
self.verticalLayout_6.addLayout(self.horizontalLayout_13)
self.gridLayout_7.addLayout(self.verticalLayout_6, 0, 0, 1, 1)
self.tabWidget.addTab(self.chatTab, "")
self.versionTab = QtWidgets.QWidget()
self.versionTab = QtWidgets.QWidget(mscolabHelpDialog)
self.versionTab.setObjectName("versionTab")
self.gridLayout_9 = QtWidgets.QGridLayout(self.versionTab)
self.gridLayout_9.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -209,7 +209,7 @@ def setupUi(self, mscolabHelpDialog):
self.verticalLayout_7.addLayout(self.horizontalLayout_14)
self.gridLayout_9.addLayout(self.verticalLayout_7, 0, 0, 1, 1)
self.tabWidget.addTab(self.versionTab, "")
self.operationWorkTab = QtWidgets.QWidget()
self.operationWorkTab = QtWidgets.QWidget(mscolabHelpDialog)
self.operationWorkTab.setObjectName("operationWorkTab")
self.gridLayout_8 = QtWidgets.QGridLayout(self.operationWorkTab)
self.gridLayout_8.setContentsMargins(0, 0, 0, 0)
Expand Down
4 changes: 2 additions & 2 deletions mslib/msui/wms_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,13 @@ def __init__(self, parent=None, default_WMS=None, wms_cache=None, view=None):

# Progress dialog to inform the user about image ongoing retrievals.
self.pdlg = QtWidgets.QProgressDialog(
"retrieving image...", "Cancel", 0, 10, parent=self.parent())
"retrieving image...", "Cancel", 0, 10, parent=self)
self.pdlg.close()

# Progress dialog to inform the user about ongoing capability requests.
self.capabilities_worker = Worker(None)
self.cpdlg = QtWidgets.QProgressDialog(
"retrieving wms capabilities...", "Cancel", 0, 10, parent=self.multilayers)
"retrieving wms capabilities...", "Cancel", 0, 10, parent=self)
self.cpdlg.canceled.connect(self.stop_capabilities_retrieval)
self.cpdlg.close()

Expand Down
2 changes: 1 addition & 1 deletion mslib/support/qt_json_view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, parent=None):

def _menu(self, position):
"""Show the actions of the DataType (if any)."""
menu = QtWidgets.QMenu()
menu = QtWidgets.QMenu(self)
index = self.indexAt(position)
data = index.data(TypeRole)
if data is None:
Expand Down

0 comments on commit 5a65510

Please sign in to comment.