Skip to content
Snippets Groups Projects
Commit 14ddde33 authored by Garrett Bates's avatar Garrett Bates
Browse files

Added missing text box to main UI; fixed erroneously labelled buttons in...

Added missing text box to main UI; fixed erroneously labelled buttons in toolbar; linked calendar buttons in toolbar to calendar dialog
parent 69a51f8b
No related branches found
No related tags found
1 merge request!3Main UI and miscellaneous associated widgets
import os
import sys
import pathlib
from functools import partial
from PySide2 import QtCore, QtGui, QtWidgets
from sohstationviewer.view.ui.main_ui import Ui_MainWindow
from sohstationviewer.view.calendardialog import CalendarDialog
......@@ -22,39 +23,42 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.currentDirectoryChanged.emit(cwd)
# File menu
self.action_Delete_Setup_File.triggered.connect(self.deleteSetupFile)
self.deleteSetup.triggered.connect(self.deleteSetupFile)
# Commands menu
self.action_GPS_Plotter.triggered.connect(self.openGpsPlot)
self.action_Log_Search.triggered.connect(self.openLogSearch)
self.actionPlot_Time_Ranges.triggered.connect(self.openPlotTimeRanges)
self.actionPlot_Positions.triggered.connect(self.openPlotPositions)
self.openGPSPlots.triggered.connect(self.openGpsPlot)
self.searchLog.triggered.connect(self.openLogSearch)
self.plotTimeRanges.triggered.connect(self.openPlotTimeRanges)
self.plotPositions.triggered.connect(self.openPlotPositions)
# Commands/Export submenu
self.action_Deployment_File.triggered.connect(self.exportDepLine)
self.actionDeployment_File_Block.triggered.connect(self.exportDepBlock)
self.action_TSP_File_Shot_Geometry.triggered.connect(self.exportTspGeom)
self.action_Shot_Info.triggered.connect(self.exportShotInfo)
self.exportDeploymentFile.triggered.connect(self.exportDepLine)
self.exportDeploymentBlock.triggered.connect(self.exportDepBlock)
self.exportTSPGeometry.triggered.connect(self.exportTspGeom)
self.exportShotInfo.triggered.connect(self.exportShotInf)
# Help menu
self.action_Calendar.triggered.connect(self.open_calendar)
self.openCalendar.triggered.connect(self.openCalendarWidget)
# Options Menu
self.sortGroup = QtWidgets.QActionGroup(self)
self.sortGroup.addAction(self.actionSort)
self.sortGroup.addAction(self.actionSort_Files_List_Alphabetically)
self.actionSort.setChecked(True)
self.sortGroup.addAction(self.sortFilesByType)
self.sortGroup.addAction(self.sortFilesAlphabetically)
self.sortFilesByType.setChecked(True)
self.colorGroup = QtWidgets.QActionGroup(self)
self.colorGroup.addAction(self.actionMP_Coloring_Regular)
self.colorGroup.addAction(self.actionMP_Coloring_Trillium)
self.actionMP_Coloring_Regular.setChecked(True)
self.colorGroup.addAction(self.colorMPRegular)
self.colorGroup.addAction(self.colorMPTrillium)
self.colorMPRegular.setChecked(True)
self.dateGroup = QtWidgets.QActionGroup(self)
self.dateGroup.addAction(self.actionShow_YYYY_DOY_Dates)
self.dateGroup.addAction(self.actionShow_YYYY)
self.dateGroup.addAction(self.actionShow_YYYYMMMDD_Dates)
self.actionShow_YYYY_DOY_Dates.setChecked(True)
self.dateGroup.addAction(self.showYYYYDOYDates)
self.dateGroup.addAction(self.showYYYY_MM_DDDates)
self.dateGroup.addAction(self.showYYYYMMMDDDates)
self.showYYYYDOYDates.setChecked(True)
self.timeFromPushButton.clicked.connect(self.onStartTimeCalendar)
self.timeToPushButton.clicked.connect(self.onEndTimeCalendar)
@QtCore.Slot()
def deleteSetupFile(self):
......@@ -89,7 +93,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
print('Exporting TSP Shot File / Geometry.')
@QtCore.Slot()
def exportShotInfo(self):
def exportShotInf(self):
print('Exporting Shot Info.')
@QtCore.Slot()
......@@ -119,8 +123,47 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
currentDirectoryChanged = QtCore.Signal(str)
@QtCore.Slot()
def open_calendar(self):
def openCalendarWidget(self):
calendar = CalendarDialog(self)
calendar.show()
@QtCore.Slot()
def setStartTime(self, calendar):
# TODO: date needs to be formatted
# according to the options
textField = self.timeFromLineEdit
date = calendar.calendarWidget.selectedDate()
textField.setText(date.toString())
@QtCore.Slot()
def setEndTime(self, calendar):
# TODO: date needs to be formatted
# according to the options
textField = self.timeToLineEdit
date = calendar.calendarWidget.selectedDate()
textField.setText(date.toString())
@QtCore.Slot()
def onStartTimeCalendar(self):
# Want to re-use the calendar dialog rather than having special ones
# for each case where it is used. Also need to detect when the dialog
# is closed, so we can get the date that the user selected. So we need
# to override the closeEvent method. A cleaner way to do this
# would be to invoke an optional callback function from closeEvent
# defined within the calendar dialog itself, if the callback has been set.
# However, I didn't even think of that until after I
# implemented this, because I haven't had coffee yet.
# I think the best way to do this may actually be to set up a slot to listen
# for the selectionChanged signal...
calendar = CalendarDialog(self)
calendar.accept = partial(MainWindow.setStartTime, self, calendar)
calendar.show()
@QtCore.Slot()
def onEndTimeCalendar(self):
calendar = CalendarDialog(self)
calendar.accept = partial(MainWindow.setEndTime, self, calendar)
calendar.show()
......
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment