From e0f5dc52c99b2f6ab40544c261f50bdd9113a53a Mon Sep 17 00:00:00 2001 From: Papoteur Date: Mon, 30 Mar 2015 22:03:08 +0200 Subject: Add About and Help dialog --- mageiaSync/mageiaSyncAbout.py | 73 ++++++++++++++++++++++ mageiaSync/mageiaSyncAbout.ui | 133 ++++++++++++++++++++++++++++++++++++++++ mageiaSync/mageiaSyncCredits.py | 43 +++++++++++++ mageiaSync/mageiaSyncCredits.ui | 62 +++++++++++++++++++ mageiaSync/mageiaSyncDBprefs.py | 14 ++--- mageiaSync/mageiaSyncDBprefs.ui | 24 ++++---- mageiaSync/mageiaSyncUI.py | 6 +- mageiaSync/mageiaSyncUI.ui | 6 ++ mageiaSync/mageiasync.py | 46 +++++++++++++- 9 files changed, 385 insertions(+), 22 deletions(-) create mode 100644 mageiaSync/mageiaSyncAbout.py create mode 100644 mageiaSync/mageiaSyncAbout.ui create mode 100644 mageiaSync/mageiaSyncCredits.py create mode 100644 mageiaSync/mageiaSyncCredits.ui (limited to 'mageiaSync') diff --git a/mageiaSync/mageiaSyncAbout.py b/mageiaSync/mageiaSyncAbout.py new file mode 100644 index 0000000..a824ad9 --- /dev/null +++ b/mageiaSync/mageiaSyncAbout.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'mageiaSyncAbout.ui' +# +# Created: Sun Mar 29 14:46:46 2015 +# by: PyQt5 UI code generator 5.1.1 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_aboutDialog(object): + def setupUi(self, aboutDialog): + aboutDialog.setObjectName("aboutDialog") + aboutDialog.resize(452, 348) + self.verticalLayout = QtWidgets.QVBoxLayout(aboutDialog) + self.verticalLayout.setObjectName("verticalLayout") + self.verticalLayout_3 = QtWidgets.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.label_4 = QtWidgets.QLabel(aboutDialog) + self.label_4.setMaximumSize(QtCore.QSize(200, 200)) + self.label_4.setText("") + self.label_4.setPixmap(QtGui.QPixmap("../../../../usr/share/icons/hicolor/scalable/apps/mageiasync.svg")) + self.label_4.setScaledContents(True) + self.label_4.setAlignment(QtCore.Qt.AlignCenter) + self.label_4.setContentsMargins(30, 30, 30, 30) + self.label_4.setIndent(0) + self.label_4.setObjectName("label_4") + self.horizontalLayout.addWidget(self.label_4) + self.verticalLayout_3.addLayout(self.horizontalLayout) + self.label = QtWidgets.QLabel(aboutDialog) + font = QtGui.QFont() + font.setPointSize(11) + self.label.setFont(font) + self.label.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) + self.label.setAlignment(QtCore.Qt.AlignCenter) + self.label.setObjectName("label") + self.verticalLayout_3.addWidget(self.label) + self.label_2 = QtWidgets.QLabel(aboutDialog) + self.label_2.setAlignment(QtCore.Qt.AlignCenter) + self.label_2.setObjectName("label_2") + self.verticalLayout_3.addWidget(self.label_2) + self.label_3 = QtWidgets.QLabel(aboutDialog) + self.label_3.setAlignment(QtCore.Qt.AlignCenter) + self.label_3.setObjectName("label_3") + self.verticalLayout_3.addWidget(self.label_3) + self.verticalLayout.addLayout(self.verticalLayout_3) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.creditsButton = QtWidgets.QPushButton(aboutDialog) + self.creditsButton.setObjectName("creditsButton") + self.horizontalLayout_2.addWidget(self.creditsButton) + self.buttonBox = QtWidgets.QDialogButtonBox(aboutDialog) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setCenterButtons(True) + self.buttonBox.setObjectName("buttonBox") + self.horizontalLayout_2.addWidget(self.buttonBox) + self.verticalLayout.addLayout(self.horizontalLayout_2) + + self.retranslateUi(aboutDialog) + self.buttonBox.accepted.connect(aboutDialog.close) + QtCore.QMetaObject.connectSlotsByName(aboutDialog) + + def retranslateUi(self, aboutDialog): + _translate = QtCore.QCoreApplication.translate + aboutDialog.setWindowTitle(_translate("aboutDialog", "MageiaSync")) + self.label.setText(_translate("aboutDialog", "mageiaSync")) + self.label_2.setText(_translate("aboutDialog", "A tool for loading ISO images. It is a frontend to rsync.")) + self.label_3.setText(_translate("aboutDialog", "License: GNU GPL v3")) + self.creditsButton.setText(_translate("aboutDialog", "Credits")) + diff --git a/mageiaSync/mageiaSyncAbout.ui b/mageiaSync/mageiaSyncAbout.ui new file mode 100644 index 0000000..a1e3105 --- /dev/null +++ b/mageiaSync/mageiaSyncAbout.ui @@ -0,0 +1,133 @@ + + + aboutDialog + + + + 0 + 0 + 452 + 348 + + + + MageiaSync + + + + + + + + + + + 200 + 200 + + + + + + + ../../../../usr/share/icons/hicolor/scalable/apps/mageiasync.svg + + + true + + + Qt::AlignCenter + + + 30 + + + 0 + + + + + + + + + + 11 + + + + + + + mageiaSync + + + Qt::AlignCenter + + + + + + + A tool for loading ISO images. It is a frontend to rsync. + + + Qt::AlignCenter + + + + + + + License: GNU GPL v3 + + + Qt::AlignCenter + + + + + + + + + + + Credits + + + + + + + QDialogButtonBox::Ok + + + true + + + + + + + + + + + buttonBox + accepted() + aboutDialog + close() + + + 225 + 319 + + + 225 + 172 + + + + + diff --git a/mageiaSync/mageiaSyncCredits.py b/mageiaSync/mageiaSyncCredits.py new file mode 100644 index 0000000..3094aff --- /dev/null +++ b/mageiaSync/mageiaSyncCredits.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'mageiaSyncCredits.ui' +# +# Created: Sun Mar 29 14:32:39 2015 +# by: PyQt5 UI code generator 5.1.1 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_creditsDialog(object): + def setupUi(self, creditsDialog): + creditsDialog.setObjectName("creditsDialog") + creditsDialog.resize(452, 346) + self.verticalLayout = QtWidgets.QVBoxLayout(creditsDialog) + self.verticalLayout.setObjectName("verticalLayout") + self.verticalLayout_3 = QtWidgets.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout_3.addLayout(self.horizontalLayout) + self.Readme = QtWidgets.QTextBrowser(creditsDialog) + self.Readme.setObjectName("Readme") + self.verticalLayout_3.addWidget(self.Readme) + self.verticalLayout.addLayout(self.verticalLayout_3) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.buttonBox = QtWidgets.QDialogButtonBox(creditsDialog) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setCenterButtons(True) + self.buttonBox.setObjectName("buttonBox") + self.horizontalLayout_2.addWidget(self.buttonBox) + self.verticalLayout.addLayout(self.horizontalLayout_2) + + self.retranslateUi(creditsDialog) + self.buttonBox.accepted.connect(creditsDialog.close) + QtCore.QMetaObject.connectSlotsByName(creditsDialog) + + def retranslateUi(self, creditsDialog): + _translate = QtCore.QCoreApplication.translate + creditsDialog.setWindowTitle(_translate("creditsDialog", "MageiaSync")) + diff --git a/mageiaSync/mageiaSyncCredits.ui b/mageiaSync/mageiaSyncCredits.ui new file mode 100644 index 0000000..8ec0d78 --- /dev/null +++ b/mageiaSync/mageiaSyncCredits.ui @@ -0,0 +1,62 @@ + + + creditsDialog + + + + 0 + 0 + 452 + 346 + + + + MageiaSync + + + + + + + + + + + + + + + + + + QDialogButtonBox::Ok + + + true + + + + + + + + + + + buttonBox + accepted() + creditsDialog + close() + + + 225 + 319 + + + 225 + 172 + + + + + diff --git a/mageiaSync/mageiaSyncDBprefs.py b/mageiaSync/mageiaSyncDBprefs.py index 0959421..9fcc3ba 100644 --- a/mageiaSync/mageiaSyncDBprefs.py +++ b/mageiaSync/mageiaSyncDBprefs.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/documents/mageiasync/mageiaSync/mageiaSyncDBprefs.ui' +# Form implementation generated from reading ui file 'mageiaSyncDBprefs.ui' # -# Created: Sun Dec 7 13:24:26 2014 +# Created: Mon Mar 30 21:56:57 2015 # by: PyQt5 UI code generator 5.1.1 # # WARNING! All changes made in this file will be lost! @@ -12,16 +12,16 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_prefsDialog(object): def setupUi(self, prefsDialog): prefsDialog.setObjectName("prefsDialog") - prefsDialog.resize(520, 234) + prefsDialog.resize(544, 336) self.buttonBox = QtWidgets.QDialogButtonBox(prefsDialog) - self.buttonBox.setGeometry(QtCore.QRect(10, 200, 511, 32)) + self.buttonBox.setGeometry(QtCore.QRect(0, 270, 521, 31)) self.buttonBox.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.formLayoutWidget = QtWidgets.QWidget(prefsDialog) - self.formLayoutWidget.setGeometry(QtCore.QRect(9, 9, 501, 185)) + self.formLayoutWidget.setGeometry(QtCore.QRect(10, 30, 511, 241)) self.formLayoutWidget.setObjectName("formLayoutWidget") self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget) self.formLayout.setContentsMargins(0, 0, 0, 0) @@ -64,6 +64,7 @@ class Ui_prefsDialog(object): self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_5) self.selectDest = QtWidgets.QPushButton(self.formLayoutWidget) self.selectDest.setToolTip("") + self.selectDest.setText("PushButton") self.selectDest.setObjectName("selectDest") self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.selectDest) self.label_6 = QtWidgets.QLabel(self.formLayoutWidget) @@ -94,7 +95,7 @@ class Ui_prefsDialog(object): prefsDialog.setWindowTitle(_translate("prefsDialog", "Preferences")) self.label.setToolTip(_translate("prefsDialog", "Give the release name like \"mageia5-alpha2\"")) self.label.setText(_translate("prefsDialog", "Release:")) - self.label_2.setToolTip(_translate("prefsDialog", "User name to access the repository. Only for testing repository.")) + self.label_2.setToolTip(_translate("prefsDialog", "User name to acces the repository. Only for testing repository.")) self.label_2.setText(_translate("prefsDialog", "User:")) self.label_3.setToolTip(_translate("prefsDialog", "Associated with user, if needed")) self.label_3.setText(_translate("prefsDialog", "Password:")) @@ -102,7 +103,6 @@ class Ui_prefsDialog(object): self.label_4.setText(_translate("prefsDialog", "Source:")) self.label_5.setToolTip(_translate("prefsDialog", "The local directory where you store ISOs. Will sync your existent ISOs already present.")) self.label_5.setText(_translate("prefsDialog", "Destination:")) - self.selectDest.setText(_translate("prefsDialog", "PushButton")) self.label_6.setToolTip(_translate("prefsDialog", "Set to zero if you don\'t want apply limit.")) self.label_6.setText(_translate("prefsDialog", "Bandwith limit (kB/s):")) self.label_7.setText(_translate("prefsDialog", "Define parameters which are stored and used for rsync")) diff --git a/mageiaSync/mageiaSyncDBprefs.ui b/mageiaSync/mageiaSyncDBprefs.ui index 581025a..8fa556d 100644 --- a/mageiaSync/mageiaSyncDBprefs.ui +++ b/mageiaSync/mageiaSyncDBprefs.ui @@ -6,8 +6,8 @@ 0 0 - 520 - 234 + 544 + 336 @@ -16,10 +16,10 @@ - 10 - 200 - 511 - 32 + 0 + 270 + 521 + 31 @@ -38,10 +38,10 @@ - 9 - 9 - 501 - 185 + 10 + 30 + 511 + 241 @@ -61,7 +61,7 @@ - User name to access the repository. Only for testing repository. + User name to acces the repository. Only for testing repository. @@ -149,7 +149,7 @@ - PushButton + PushButton diff --git a/mageiaSync/mageiaSyncUI.py b/mageiaSync/mageiaSyncUI.py index 53c6f10..07461d3 100644 --- a/mageiaSync/mageiaSyncUI.py +++ b/mageiaSync/mageiaSyncUI.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mageiaSyncUI.ui' # -# Created: Mon Mar 23 22:38:56 2015 +# Created: Sun Mar 29 15:53:06 2015 # by: PyQt5 UI code generator 5.1.1 # # WARNING! All changes made in this file will be lost! @@ -143,11 +143,14 @@ class Ui_mainWindow(object): self.actionCheck.setObjectName("actionCheck") self.actionAbout = QtWidgets.QAction(mainWindow) self.actionAbout.setObjectName("actionAbout") + self.actionOnline_help = QtWidgets.QAction(mainWindow) + self.actionOnline_help.setObjectName("actionOnline_help") self.menuFile.addAction(self.actionUpdate) self.menuFile.addAction(self.actionPreferences) self.menuFile.addAction(self.actionQuit) self.menuSync.addAction(self.actionRename) self.menuSync.addAction(self.actionCheck) + self.menuA_bout.addAction(self.actionOnline_help) self.menuA_bout.addAction(self.actionAbout) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuSync.menuAction()) @@ -180,4 +183,5 @@ class Ui_mainWindow(object): self.actionCheck.setText(_translate("mainWindow", "&Check")) self.actionCheck.setToolTip(_translate("mainWindow", "Check selected images")) self.actionAbout.setText(_translate("mainWindow", "A&bout")) + self.actionOnline_help.setText(_translate("mainWindow", "Online &help")) diff --git a/mageiaSync/mageiaSyncUI.ui b/mageiaSync/mageiaSyncUI.ui index 6e530bf..ffa737e 100644 --- a/mageiaSync/mageiaSyncUI.ui +++ b/mageiaSync/mageiaSyncUI.ui @@ -308,6 +308,7 @@ &Help + @@ -348,6 +349,11 @@ A&bout + + + Online &help + + syncGo diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py index 8f77458..fb2b658 100644 --- a/mageiaSync/mageiasync.py +++ b/mageiaSync/mageiasync.py @@ -2,8 +2,8 @@ from PyQt5.QtWidgets import ( QProgressDialog, QMainWindow, QDialog, QFileDialog, QApplication) -from PyQt5.QtGui import ( QStandardItemModel,QStandardItem, ) -from PyQt5.QtCore import ( QLibraryInfo, ) +from PyQt5.QtGui import ( QStandardItemModel,QStandardItem, QDesktopServices, ) +from PyQt5.QtCore import ( QLibraryInfo, QUrl ) from PyQt5 import QtCore # , Qt, QThread, QObject, pyqtSignal) import sys import mageiaSyncUI @@ -11,6 +11,9 @@ import mageiaSyncExt import mageiaSyncDBprefs import mageiaSyncDBprefs0 import mageiaSyncDBrename +import mageiaSyncAbout +import mageiaSyncCredits + class prefsDialog(QDialog,mageiaSyncDBprefs.Ui_prefsDialog ): @@ -34,6 +37,28 @@ class renameDialog(QDialog,mageiaSyncDBrename.Ui_renameDialog ): self.setupUi(self) self.chooseDir.clicked.connect(isosSync.renameDir) +class aboutDialog(QDialog,mageiaSyncAbout.Ui_aboutDialog ): + + def __init__(self, parent=None): + QDialog.__init__(self,parent) + self.setupUi(self) + self.creditsButton.clicked.connect(isosSync.credits) + +class creditsDialog(QDialog,mageiaSyncCredits.Ui_creditsDialog ): + + def __init__(self, parent=None): + QDialog.__init__(self,parent) + self.setupUi(self) + text='' + try: + with open('/usr/share/doc/mageiasync/README.md', 'r') as f: + block = f.readlines() + for line in block: + text+= line + except: + pass + self.Readme.setText(text) + class LogWindow(QProgressDialog): # Display a box at start during the remote directory list loading @@ -365,6 +390,8 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.actionPreferences.triggered.connect(self.prefs) self.syncGo.clicked.connect(self.launchSync) self.selectAll.clicked.connect(self.selectAllIsos) + self.actionAbout.triggered.connect(self.about) + self.actionOnline_help.triggered.connect(self.help) def updateList(self): # From the menu entry @@ -435,6 +462,21 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.updateList() self.pd.close() + def about(self): + ad = aboutDialog() + answer=ad.exec_() + if answer: + ad.close() + + def credits(self): + ad = creditsDialog() + answer=ad.exec_() + if answer: + ad.close() + + def help(self): + # Open page in browser + l = QDesktopServices.openUrl(QUrl('http://wiki.mageia.org/en/MageiaSync')) def launchSync(self): self.IprogressBar.setEnabled(True) -- cgit v1.2.1