Skip to content

Commit

Permalink
Add menu item to check for new releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Ho committed Jul 7, 2017
1 parent a301a2b commit 0dc77e4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
5 changes: 5 additions & 0 deletions designer/battery_window_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def setupUi(self, CognitiveBattery):
self.actionAnalysis = QtWidgets.QAction(CognitiveBattery)
self.actionAnalysis.setEnabled(False)
self.actionAnalysis.setObjectName("actionAnalysis")
self.actionCheck_for_updates = QtWidgets.QAction(CognitiveBattery)
self.actionCheck_for_updates.setObjectName("actionCheck_for_updates")
self.menuFile.addAction(self.actionExit)
self.menuHelp.addAction(self.actionDocumentation)
self.menuHelp.addAction(self.actionLicense)
Expand All @@ -252,6 +254,7 @@ def setupUi(self, CognitiveBattery):
self.menuHelp.addAction(self.actionReport_Bug)
self.menuHelp.addAction(self.actionRequest_Feature)
self.menuHelp.addSeparator()
self.menuHelp.addAction(self.actionCheck_for_updates)
self.menuHelp.addAction(self.actionAbout)
self.menuOptions.addAction(self.actionSettings)
self.menubar.addAction(self.menuFile.menuAction())
Expand Down Expand Up @@ -330,4 +333,6 @@ def retranslateUi(self, CognitiveBattery):
self.actionAbout.setStatusTip(_translate("CognitiveBattery", "About the battery"))
self.actionAnalysis.setText(_translate("CognitiveBattery", "Analysis"))
self.actionAnalysis.setStatusTip(_translate("CognitiveBattery", "Calculate aggregate data for all tasks"))
self.actionCheck_for_updates.setText(_translate("CognitiveBattery", "Check for updates"))
self.actionCheck_for_updates.setStatusTip(_translate("CognitiveBattery", "Check for new releases of the battery"))

5 changes: 5 additions & 0 deletions designer/project_window_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def setupUi(self, ProjectWindow):
self.actionRequest_Feature.setObjectName("actionRequest_Feature")
self.actionAbout = QtWidgets.QAction(ProjectWindow)
self.actionAbout.setObjectName("actionAbout")
self.actionCheck_for_updates = QtWidgets.QAction(ProjectWindow)
self.actionCheck_for_updates.setObjectName("actionCheck_for_updates")
self.menuProject.addAction(self.actionNewProject)
self.menuProject.addAction(self.actionExit)
self.menuHelp.addAction(self.actionDocumentation)
Expand All @@ -174,6 +176,7 @@ def setupUi(self, ProjectWindow):
self.menuHelp.addAction(self.actionReport_Bug)
self.menuHelp.addAction(self.actionRequest_Feature)
self.menuHelp.addSeparator()
self.menuHelp.addAction(self.actionCheck_for_updates)
self.menuHelp.addAction(self.actionAbout)
self.menubar.addAction(self.menuProject.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())
Expand Down Expand Up @@ -216,4 +219,6 @@ def retranslateUi(self, ProjectWindow):
self.actionRequest_Feature.setStatusTip(_translate("ProjectWindow", "Request a feature"))
self.actionAbout.setText(_translate("ProjectWindow", "About"))
self.actionAbout.setStatusTip(_translate("ProjectWindow", "About the battery"))
self.actionCheck_for_updates.setText(_translate("ProjectWindow", "Check for updates"))
self.actionCheck_for_updates.setStatusTip(_translate("ProjectWindow", "Check for new releases of the battery"))

9 changes: 9 additions & 0 deletions designer/ui/battery_window_qt.ui
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@
<addaction name="actionReport_Bug"/>
<addaction name="actionRequest_Feature"/>
<addaction name="separator"/>
<addaction name="actionCheck_for_updates"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuOptions">
Expand Down Expand Up @@ -579,6 +580,14 @@
<string>Calculate aggregate data for all tasks</string>
</property>
</action>
<action name="actionCheck_for_updates">
<property name="text">
<string>Check for updates</string>
</property>
<property name="statusTip">
<string>Check for new releases of the battery</string>
</property>
</action>
</widget>
<resources/>
<connections/>
Expand Down
9 changes: 9 additions & 0 deletions designer/ui/project_window_qt.ui
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
<addaction name="actionReport_Bug"/>
<addaction name="actionRequest_Feature"/>
<addaction name="separator"/>
<addaction name="actionCheck_for_updates"/>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuProject"/>
Expand Down Expand Up @@ -377,6 +378,14 @@
<string>About the battery</string>
</property>
</action>
<action name="actionCheck_for_updates">
<property name="text">
<string>Check for updates</string>
</property>
<property name="statusTip">
<string>Check for new releases of the battery</string>
</property>
</action>
</widget>
<resources/>
<connections/>
Expand Down
9 changes: 8 additions & 1 deletion interface/battery_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, base_dir, project_dir, res_width, res_height):
self.actionBrowse_Issues.setIcon(QtGui.QIcon(self.github_icon))
self.actionReport_Bug.setIcon(QtGui.QIcon(self.github_icon))
self.actionRequest_Feature.setIcon(QtGui.QIcon(self.github_icon))
self.actionCheck_for_updates.setIcon(QtGui.QIcon(self.github_icon))

# Get screen resolution
self.project_dir = project_dir
Expand Down Expand Up @@ -98,7 +99,8 @@ def __init__(self, base_dir, project_dir, res_width, res_height):
"cognitive-battery/tree/develop",
"issues": "https://github.com/sho-87/cognitive-battery/issues",
"new_issue": "https://github.com/sho-87/"
"cognitive-battery/issues/new"
"cognitive-battery/issues/new",
"releases": "https://github.com/sho-87/cognitive-battery/releases"
}

# Get base directory for battery
Expand All @@ -118,6 +120,7 @@ def __init__(self, base_dir, project_dir, res_width, res_height):
self.actionBrowse_Issues.triggered.connect(self.show_browse_issues)
self.actionReport_Bug.triggered.connect(self.show_new_issue)
self.actionRequest_Feature.triggered.connect(self.show_new_issue)
self.actionCheck_for_updates.triggered.connect(self.show_releases)
self.actionAbout.triggered.connect(self.show_about)

# Bind button events
Expand Down Expand Up @@ -149,6 +152,10 @@ def show_browse_issues(self):
def show_new_issue(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.LINKS["new_issue"]))

# Open web browser to the github releases page
def show_releases(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.LINKS["releases"]))

# Create a new SettingsWindow object and display it
def show_settings(self):
# If the settings window does not exist, create one
Expand Down
9 changes: 8 additions & 1 deletion interface/project_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, base_dir, res_width, res_height):
self.actionBrowse_Issues.setIcon(QtGui.QIcon(self.github_icon))
self.actionReport_Bug.setIcon(QtGui.QIcon(self.github_icon))
self.actionRequest_Feature.setIcon(QtGui.QIcon(self.github_icon))
self.actionCheck_for_updates.setIcon(QtGui.QIcon(self.github_icon))

# Keep reference to main battery and new project windows
self.main_battery = None
Expand All @@ -44,7 +45,8 @@ def __init__(self, base_dir, res_width, res_height):
"cognitive-battery/tree/develop",
"issues": "https://github.com/sho-87/cognitive-battery/issues",
"new_issue": "https://github.com/sho-87/"
"cognitive-battery/issues/new"
"cognitive-battery/issues/new",
"releases": "https://github.com/sho-87/cognitive-battery/releases"
}

# Check if project file exists
Expand All @@ -68,6 +70,7 @@ def __init__(self, base_dir, res_width, res_height):
self.actionBrowse_Issues.triggered.connect(self.show_browse_issues)
self.actionReport_Bug.triggered.connect(self.show_new_issue)
self.actionRequest_Feature.triggered.connect(self.show_new_issue)
self.actionCheck_for_updates.triggered.connect(self.show_releases)
self.actionAbout.triggered.connect(self.show_about)

# Bind button events
Expand Down Expand Up @@ -104,6 +107,10 @@ def show_browse_issues(self):
def show_new_issue(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.LINKS["new_issue"]))

# Open web browser to the github releases page
def show_releases(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.LINKS["releases"]))

# Create a new AboutDialog object and display it
def show_about(self):
# If the about dialog does not exist, create one
Expand Down

0 comments on commit 0dc77e4

Please sign in to comment.