Skip to content

Commit

Permalink
Merge branch 'master' into dev-mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Eltoft committed Dec 2, 2017
2 parents 2b32ba2 + a4fb82d commit cf4e220
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 0 deletions.
52 changes: 52 additions & 0 deletions gui/about_dialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file './gui/qt\about_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets


# Added by buildgui.py script to support pyinstaller
from src.helpers.pyinstaller_helper import PyInstallerHelper

class Ui_AboutDialog(object):
def setupUi(self, AboutDialog):
AboutDialog.setObjectName("AboutDialog")
AboutDialog.resize(300, 90)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(AboutDialog.sizePolicy().hasHeightForWidth())
AboutDialog.setSizePolicy(sizePolicy)
AboutDialog.setMinimumSize(QtCore.QSize(300, 90))
AboutDialog.setMaximumSize(QtCore.QSize(300, 90))
AboutDialog.setSizeGripEnabled(False)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(AboutDialog)
self.verticalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(AboutDialog)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
spacerItem = QtWidgets.QSpacerItem(100, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.versionLabel = QtWidgets.QLabel(AboutDialog)
self.versionLabel.setObjectName("versionLabel")
self.horizontalLayout.addWidget(self.versionLabel)
self.verticalLayout_2.addLayout(self.horizontalLayout)
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem1)

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

def retranslateUi(self, AboutDialog):
_translate = QtCore.QCoreApplication.translate
AboutDialog.setWindowTitle(_translate("AboutDialog", "About uPyLoader"))
self.label.setText(_translate("AboutDialog", "Version:"))
self.versionLabel.setText(_translate("AboutDialog", "XXX"))

8 changes: 8 additions & 0 deletions gui/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ def setupUi(self, MainWindow):
self.menuView.setObjectName("menuView")
self.menuOptions = QtWidgets.QMenu(self.menubar)
self.menuOptions.setObjectName("menuOptions")
self.menuHelp = QtWidgets.QMenu(self.menubar)
self.menuHelp.setObjectName("menuHelp")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
Expand All @@ -260,15 +262,19 @@ def setupUi(self, MainWindow):
self.actionFlash.setObjectName("actionFlash")
self.actionSettings = QtWidgets.QAction(MainWindow)
self.actionSettings.setObjectName("actionSettings")
self.actionAbout = QtWidgets.QAction(MainWindow)
self.actionAbout.setObjectName("actionAbout")
self.menuFile.addAction(self.actionNavigate)
self.menuFile.addAction(self.actionUpload)
self.menuFile.addAction(self.actionFlash)
self.menuView.addAction(self.actionTerminal)
self.menuView.addAction(self.actionCode_Editor)
self.menuOptions.addAction(self.actionSettings)
self.menuHelp.addAction(self.actionAbout)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuView.menuAction())
self.menubar.addAction(self.menuOptions.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())

self.retranslateUi(MainWindow)
self.connectionStackedWidget.setCurrentIndex(0)
Expand Down Expand Up @@ -304,12 +310,14 @@ def retranslateUi(self, MainWindow):
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.menuView.setTitle(_translate("MainWindow", "View"))
self.menuOptions.setTitle(_translate("MainWindow", "Options"))
self.menuHelp.setTitle(_translate("MainWindow", "Help"))
self.actionNavigate.setText(_translate("MainWindow", "Navigate"))
self.actionTerminal.setText(_translate("MainWindow", "Terminal"))
self.actionUpload.setText(_translate("MainWindow", "Init transfer files"))
self.actionCode_Editor.setText(_translate("MainWindow", "Code Editor"))
self.actionFlash.setText(_translate("MainWindow", "Flash firmware"))
self.actionSettings.setText(_translate("MainWindow", "Settings"))
self.actionAbout.setText(_translate("MainWindow", "About uPyLoader"))

from src.gui.controls.transfer_tree_view import TransferTreeView
# Added by buildgui.py script to support pyinstaller
Expand Down
92 changes: 92 additions & 0 deletions gui/qt/about_dialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>90</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>90</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>90</height>
</size>
</property>
<property name="windowTitle">
<string>About uPyLoader</string>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>XXX</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
12 changes: 12 additions & 0 deletions gui/qt/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,16 @@
</property>
<addaction name="actionSettings"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
<addaction name="menuOptions"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionNavigate">
Expand Down Expand Up @@ -565,6 +572,11 @@
<string>Settings</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
<string>About uPyLoader</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down
17 changes: 17 additions & 0 deletions src/gui/about_dialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from PyQt5.QtCore import pyqtSignal, Qt
from PyQt5.QtGui import QFontDatabase
from PyQt5.QtWidgets import QMessageBox, QDialog

from gui.about_dialog import Ui_AboutDialog
from gui.code_edit import Ui_CodeEditDialog
from src.gui.file_transfer_dialog import FileTransferDialog
from src.utility.settings import Settings


class AboutDialog(QDialog, Ui_AboutDialog):
def __init__(self, parent):
super(AboutDialog, self).__init__(parent, Qt.WindowCloseButtonHint)
self.setupUi(self)
self.setModal(True)
self.setSizeGripEnabled(False)
self.versionLabel.setText("0.1.3 (dev)")
13 changes: 13 additions & 0 deletions src/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from src.connection.serial_connection import SerialConnection
from src.connection.terminal import Terminal
from src.connection.wifi_connection import WifiConnection
from src.gui.about_dialog import AboutDialog
from src.gui.code_edit_dialog import CodeEditDialog
from src.gui.file_transfer_dialog import FileTransferDialog
from src.gui.flash_dialog import FlashDialog
Expand Down Expand Up @@ -42,6 +43,7 @@ def __init__(self):
self._code_editor = None
self._flash_dialog = None
self._settings_dialog = None
self._about_dialog = None
self._preset_password = None

self.actionNavigate.triggered.connect(self.navigate_directory)
Expand All @@ -50,6 +52,7 @@ def __init__(self):
self.actionUpload.triggered.connect(self.upload_transfer_scripts)
self.actionFlash.triggered.connect(self.open_flash_dialog)
self.actionSettings.triggered.connect(self.open_settings_dialog)
self.actionAbout.triggered.connect(self.open_about_dialog)

self.connectionComboBox.currentIndexChanged.connect(self.connection_changed)
self.refreshButton.clicked.connect(self.refresh_ports)
Expand Down Expand Up @@ -591,3 +594,13 @@ def close_settings_dialog(self):
self._settings_dialog = None
# Update compile button as mpy-cross path might have been set
self.update_compile_button()

def open_about_dialog(self):
if self._about_dialog is not None:
return
self._settings_dialog = AboutDialog(self)
self._settings_dialog.finished.connect(self.close_about_dialog)
self._settings_dialog.show()

def close_about_dialog(self):
self._about_dialog = None

0 comments on commit cf4e220

Please sign in to comment.