Skip to content

Commit

Permalink
removed activate flighttrack submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindm711 committed Jul 5, 2021
1 parent 1f72361 commit a4fdf64
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 25 deletions.
20 changes: 17 additions & 3 deletions mslib/msui/mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
from mslib.msui.mss_qt import ui_add_project_dialog as add_project_ui
from mslib.msui.mss_qt import ui_mscolab_merge_waypoints_dialog as merge_wp_ui
from mslib.msui.mss_qt import ui_mscolab_connect_dialog as ui_conn
from mslib.msui.mss_qt import ui_mscolab_profile_dialog as ui_profile
from mslib.utils import load_settings_qsettings, save_settings_qsettings, dropEvent, dragEnterEvent, show_popup
from mslib.msui import constants
from mslib.utils import config_loader
Expand Down Expand Up @@ -465,8 +466,7 @@ def after_login(self, emailid, url, r):
self.ui.usernameLabel.show()
# set up user menu and add to toolbutton
self.user_menu = QtWidgets.QMenu()
# self.user_menu.addAction("Profile")
# self.user_menu.addAction("Help")
self.profile_action = self.user_menu.addAction("Profile", self.open_profile_window)
self.logout_action = self.user_menu.addAction("Logout", self.logout)
self.ui.userOptionsTb.setPopupMode(QtWidgets.QToolButton.InstantPopup)
self.ui.userOptionsTb.setMenu(self.user_menu)
Expand Down Expand Up @@ -500,6 +500,20 @@ def verify_user_token(self):
return False
return r.text == "True"

def open_profile_window(self):
self.prof_diag = QtWidgets.QDialog()
self.profile_dialog = ui_profile.Ui_ProfileWindow()
self.profile_dialog.setupUi(self.prof_diag)
self.profile_dialog.f_content = None
self.profile_dialog.buttonBox.accepted.connect(lambda: self.prof_diag.close())
self.profile_dialog.usernameLabel_2.setText(self.user['username'])
self.profile_dialog.mscolabURLLabel_2.setText(self.mscolab_server_url)
# self.profile_dialog.emailLabel_2.setText(self.user['email'])
# self.profile_dialog.path.textChanged.connect(check_and_enable_project_accept)
# self.profile_dialog.description.textChanged.connect(check_and_enable_project_accept)
# self.profile_dialog.browse.clicked.connect(browse)
self.prof_diag.show()

def add_project_handler(self):
if self.verify_user_token():
def check_and_enable_project_accept():
Expand Down Expand Up @@ -1071,7 +1085,7 @@ def hide_project_options(self):
self.ui.workLocallyCheckbox.setEnabled(False)
self.ui.serverOptionsCb.hide()
# change working status label
self.ui.workingStatusLabel.setText(self.ui.tr("No Project Selected"))
self.ui.workingStatusLabel.setText(self.ui.tr("\n\nNo Project Selected"))

def request_wps_from_server(self):
if self.verify_user_token():
Expand Down
16 changes: 6 additions & 10 deletions mslib/msui/mss_pyui.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def __init__(self, mscolab_data_dir=None, *args):
# File menu.
self.actionNewFlightTrack.triggered.connect(functools.partial(self.create_new_flight_track, None, None))
self.actionOpenFlightTrack.triggered.connect(self.open_flight_track)
self.actionActivateSelectedFlightTrack.triggered.connect(self.activate_selected_flight_track)
self.actionSaveActiveFlightTrack.triggered.connect(self.save_flight_track)
self.actionSaveActiveFlightTrackAs.triggered.connect(self.save_flight_track_as)
self.actionCloseSelectedFlightTrack.triggered.connect(self.close_selected_flight_track)
Expand Down Expand Up @@ -335,12 +334,11 @@ def menu_handler(self):
self.actionImportFlightTrackFTML.setVisible(not self.local_active)
self.actionExportFlightTrackFTML.setVisible(not self.local_active)

# # enable/disable flight track menus
# enable/disable flight track menus
# self.actionNewFlightTrack.setEnabled(self.local_active)
# self.actionOpenFlightTrack.setEnabled(self.local_active)
# self.actionActivateSelectedFlightTrack.setEnabled(self.local_active)
# self.actionSaveActiveFlightTrack.setEnabled(self.local_active)
# self.actionSaveActiveFlightTrackAs.setEnabled(self.local_active)
self.actionSaveActiveFlightTrack.setEnabled(self.local_active)
self.actionSaveActiveFlightTrackAs.setEnabled(self.local_active)
# self.actionCloseSelectedFlightTrack.setEnabled(self.local_active)

def add_plugin_submenu(self, name, extension, plugin_type="Import"):
Expand Down Expand Up @@ -507,8 +505,8 @@ def create_new_flight_track(self, template=None, filename=None):
listitem = QFlightTrackListWidgetItem(waypoints_model, self.listFlightTracks)
listitem.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)

# # Activate new item
# self.activate_flight_track(listitem)
# Activate new item
self.activate_flight_track(listitem)

def open_flight_track(self):
"""Slot for the 'Open Flight Track' menu entry. Opens a QFileDialog and
Expand Down Expand Up @@ -611,7 +609,7 @@ def close_selected_flight_track(self):
self.tr("At least one flight track has to be open."))
return
item = self.listFlightTracks.currentItem()
if item.flighttrack_model == self.active_flight_track:
if item.flighttrack_model == self.active_flight_track and not self.local_active:
QtWidgets.QMessageBox.information(self, self.tr("Flight Track Management"),
self.tr("Cannot close currently active flight track."))
return
Expand Down Expand Up @@ -875,8 +873,6 @@ def main():
mainwindow = MSSMainWindow()
mainwindow.setStyleSheet("QListWidget { border: 1px solid grey; }")
mainwindow.create_new_flight_track()
mainwindow.listFlightTracks.setCurrentRow(0)
mainwindow.activate_selected_flight_track()
mainwindow.show()
sys.exit(application.exec_())

Expand Down
1 change: 1 addition & 0 deletions mslib/msui/mss_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def variant_to_float(variant, locale=QtCore.QLocale()):
"ui_mscolab_help_dialog",
"ui_add_project_dialog",
"ui_mscolab_merge_waypoints_dialog",
"ui_mscolab_profile_dialog",
"ui_performance_dockwidget",
"ui_remotesensing_dockwidget",
"ui_satellite_dockwidget",
Expand Down
5 changes: 0 additions & 5 deletions mslib/msui/qt5/ui_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ def setupUi(self, MSSMainWindow):
self.actionQuit.setObjectName("actionQuit")
self.actionShortcuts = QtWidgets.QAction(MSSMainWindow)
self.actionShortcuts.setObjectName("actionShortcuts")
self.actionActivateSelectedFlightTrack = QtWidgets.QAction(MSSMainWindow)
self.actionActivateSelectedFlightTrack.setObjectName("actionActivateSelectedFlightTrack")
self.actionCloseSelectedFlightTrack = QtWidgets.QAction(MSSMainWindow)
self.actionCloseSelectedFlightTrack.setObjectName("actionCloseSelectedFlightTrack")
self.actionUpdater = QtWidgets.QAction(MSSMainWindow)
Expand Down Expand Up @@ -173,8 +171,6 @@ def setupUi(self, MSSMainWindow):
self.menuFile.addAction(self.actionOpenFlightTrack)
self.menuFile.addAction(self.actionAddProject)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionActivateSelectedFlightTrack)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionSaveActiveFlightTrack)
self.menuFile.addAction(self.actionSaveActiveFlightTrackAs)
self.menuFile.addSeparator()
Expand Down Expand Up @@ -253,7 +249,6 @@ def retranslateUi(self, MSSMainWindow):
self.actionQuit.setShortcut(_translate("MSSMainWindow", "Ctrl+Q"))
self.actionShortcuts.setText(_translate("MSSMainWindow", "&Shortcuts"))
self.actionShortcuts.setShortcut(_translate("MSSMainWindow", "Alt+S"))
self.actionActivateSelectedFlightTrack.setText(_translate("MSSMainWindow", "&Activate Selected Flight Track"))
self.actionCloseSelectedFlightTrack.setText(_translate("MSSMainWindow", "&Close Selected Flight Track"))
self.actionUpdater.setText(_translate("MSSMainWindow", "&Updater"))
self.actionConfiguration.setText(_translate("MSSMainWindow", "&Configuration"))
Expand Down
81 changes: 81 additions & 0 deletions mslib/msui/qt5/ui_mscolab_profile_dialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'mslib/msui/ui/ui_mscolab_profile_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.12.3
#
# WARNING! All changes made in this file will be lost!


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_ProfileWindow(object):
def setupUi(self, ProfileWindow):
ProfileWindow.setObjectName("ProfileWindow")
ProfileWindow.resize(277, 140)
self.gridLayout = QtWidgets.QGridLayout(ProfileWindow)
self.gridLayout.setObjectName("gridLayout")
self.infoGl = QtWidgets.QGridLayout()
self.infoGl.setObjectName("infoGl")
self.emailLabel_2 = QtWidgets.QLabel(ProfileWindow)
self.emailLabel_2.setText("")
self.emailLabel_2.setObjectName("emailLabel_2")
self.infoGl.addWidget(self.emailLabel_2, 1, 1, 1, 1)
self.emailLabel = QtWidgets.QLabel(ProfileWindow)
self.emailLabel.setObjectName("emailLabel")
self.infoGl.addWidget(self.emailLabel, 1, 0, 1, 1)
self.usernameLabel = QtWidgets.QLabel(ProfileWindow)
self.usernameLabel.setObjectName("usernameLabel")
self.infoGl.addWidget(self.usernameLabel, 0, 0, 1, 1)
self.usernameLabel_2 = QtWidgets.QLabel(ProfileWindow)
self.usernameLabel_2.setText("")
self.usernameLabel_2.setObjectName("usernameLabel_2")
self.infoGl.addWidget(self.usernameLabel_2, 0, 1, 1, 1)
self.mscolabURLLabel = QtWidgets.QLabel(ProfileWindow)
self.mscolabURLLabel.setObjectName("mscolabURLLabel")
self.infoGl.addWidget(self.mscolabURLLabel, 2, 0, 1, 1)
self.mscolabURLLabel_2 = QtWidgets.QLabel(ProfileWindow)
self.mscolabURLLabel_2.setText("")
self.mscolabURLLabel_2.setObjectName("mscolabURLLabel_2")
self.infoGl.addWidget(self.mscolabURLLabel_2, 2, 1, 1, 1)
self.gridLayout.addLayout(self.infoGl, 0, 0, 1, 1)
self.gravatarVl = QtWidgets.QVBoxLayout()
self.gravatarVl.setObjectName("gravatarVl")
self.gravatarLabel = QtWidgets.QLabel(ProfileWindow)
self.gravatarLabel.setText("")
self.gravatarLabel.setObjectName("gravatarLabel")
self.gravatarVl.addWidget(self.gravatarLabel, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.setGravatarBtn = QtWidgets.QPushButton(ProfileWindow)
self.setGravatarBtn.setObjectName("setGravatarBtn")
self.gravatarVl.addWidget(self.setGravatarBtn, 0, QtCore.Qt.AlignHCenter)
self.gridLayout.addLayout(self.gravatarVl, 0, 1, 2, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(ProfileWindow)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 2, 1, 1, 1, QtCore.Qt.AlignRight)
self.deleteAccountBtn = QtWidgets.QPushButton(ProfileWindow)
self.deleteAccountBtn.setObjectName("deleteAccountBtn")
self.gridLayout.addWidget(self.deleteAccountBtn, 2, 0, 1, 1, QtCore.Qt.AlignLeft)

self.retranslateUi(ProfileWindow)
QtCore.QMetaObject.connectSlotsByName(ProfileWindow)

def retranslateUi(self, ProfileWindow):
_translate = QtCore.QCoreApplication.translate
ProfileWindow.setWindowTitle(_translate("ProfileWindow", "MSColab Profile"))
self.emailLabel.setText(_translate("ProfileWindow", "Email:"))
self.usernameLabel.setText(_translate("ProfileWindow", "Name:"))
self.mscolabURLLabel.setText(_translate("ProfileWindow", "Mscolab:"))
self.setGravatarBtn.setText(_translate("ProfileWindow", "Set Gravatar"))
self.deleteAccountBtn.setText(_translate("ProfileWindow", "Delete Account"))


if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
ProfileWindow = QtWidgets.QDialog()
ui = Ui_ProfileWindow()
ui.setupUi(ProfileWindow)
ProfileWindow.show()
sys.exit(app.exec_())
7 changes: 0 additions & 7 deletions mslib/msui/ui/ui_mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@
<addaction name="actionOpenFlightTrack"/>
<addaction name="actionAddProject"/>
<addaction name="separator"/>
<addaction name="actionActivateSelectedFlightTrack"/>
<addaction name="separator"/>
<addaction name="actionSaveActiveFlightTrack"/>
<addaction name="actionSaveActiveFlightTrackAs"/>
<addaction name="separator"/>
Expand Down Expand Up @@ -365,11 +363,6 @@
<string>Alt+S</string>
</property>
</action>
<action name="actionActivateSelectedFlightTrack">
<property name="text">
<string>&amp;Activate Selected Flight Track</string>
</property>
</action>
<action name="actionCloseSelectedFlightTrack">
<property name="text">
<string>&amp;Close Selected Flight Track</string>
Expand Down
99 changes: 99 additions & 0 deletions mslib/msui/ui/ui_mscolab_profile_dialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProfileWindow</class>
<widget class="QDialog" name="ProfileWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>277</width>
<height>140</height>
</rect>
</property>
<property name="windowTitle">
<string>MSColab Profile</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QGridLayout" name="infoGl">
<item row="1" column="1">
<widget class="QLabel" name="emailLabel_2">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="emailLabel">
<property name="text">
<string>Email:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="usernameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="usernameLabel_2">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mscolabURLLabel">
<property name="text">
<string>Mscolab:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="mscolabURLLabel_2">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" rowspan="2">
<layout class="QVBoxLayout" name="gravatarVl">
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QLabel" name="gravatarLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QPushButton" name="setGravatarBtn">
<property name="text">
<string>Set Gravatar</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1" alignment="Qt::AlignRight">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignLeft">
<widget class="QPushButton" name="deleteAccountBtn">
<property name="text">
<string>Delete Account</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

0 comments on commit a4fdf64

Please sign in to comment.