def splash_screen(): """ """ pm = QPixmap( pkg_resources.resource_filename( __name__, "icons/orange-splash-screen.png") ) version = QCoreApplication.applicationVersion() size = 21 if len(version) < 5 else 16 font = QFont("Helvetica") font.setPixelSize(size) font.setBold(True) font.setItalic(True) font.setLetterSpacing(QFont.AbsoluteSpacing, 2) metrics = QFontMetrics(font) br = metrics.boundingRect(version).adjusted(-5, 0, 5, 0) br.moveCenter(QPoint(436, 224)) p = QPainter(pm) p.setRenderHint(QPainter.Antialiasing) p.setRenderHint(QPainter.TextAntialiasing) p.setFont(font) p.setPen(QColor("#231F20")) p.drawText(br, Qt.AlignCenter, version) p.end() return pm, QRect(88, 193, 200, 20)
def __init__(self, parent, error): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint QDialog.__init__(self, parent, flags) self._setupUi() name = QCoreApplication.applicationName() version = QCoreApplication.applicationVersion() errorText = "Application Name: {0}\nVersion: {1}\n\n{2}".format(name, version, error) # Under windows, we end up with an error report without linesep if we don't mangle it errorText = errorText.replace('\n', os.linesep) self.errorTextEdit.setPlainText(errorText) self.sendButton.clicked.connect(self.accept) self.dontSendButton.clicked.connect(self.reject)
def __init__(self, parent, error): flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint QDialog.__init__(self, parent, flags) self._setupUi() name = QCoreApplication.applicationName() version = QCoreApplication.applicationVersion() errorText = "Application Name: {0}\nVersion: {1}\n\n{2}".format( name, version, error) # Under windows, we end up with an error report without linesep if we don't mangle it errorText = errorText.replace('\n', os.linesep) self.errorTextEdit.setPlainText(errorText) self.sendButton.clicked.connect(self.accept) self.dontSendButton.clicked.connect(self.reject)
def __init__(self, parent = None): """ Constructor """ QMainWindow.__init__(self, parent) #Use QMainWindow.__init___ self.setupUi(self) #setup the ui... #IMPORTANT: the line "QtCore.QMetaObject.connectSlotsByName(MainWindow)" in UI_MainWindow.py MUST be commented. self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, QCoreApplication.organizationName(), QCoreApplication.applicationName()) #Instantiate QSettings, using ini format always self.Fuze = fuze.Fuze(self) #Instantiate the Fuze class. self.resis = p2fuze.TransFuze(self) #AnotherTestPlugin her useful class. if os.name != 'nt': #If you are lucky and don't run that OS... self.mediaroot = "/media" #this is a very probable directory to start from to look for the fuze. else: self.mediaroot = os.path.join(os.path.expanduser("~"), "Desktop") #Otherwise, here we have the classical desktop... self.playlistname = self.mediaroot #Apply that for playlists too try: self.tableWidget.horizontalHeader().setResizeMode(3) #Try to fix size of tableWidgets self.tableWidget_2.horizontalHeader().setResizeMode(3) except: print "Your version of PyQt4 seems a bit out of date. This may lead to problems. But may not :)" #Most probable. The fact is that it doesn't work in PySide and older PyQt4. self.output = toPython(self.settings.value("outputdir",QVariant(os.path.expanduser("~"))).toString()) #Where to output things. self.setWindowTitle(QCoreApplication.applicationName()+" "+QCoreApplication.applicationVersion()) ##### These should be commented in case QtCore.QMetaObject.connectSlotsByName(MainWindow) in UI_MainWindow.py isn't commented. self.connect(self.actionAbout_Qt, SIGNAL("triggered()"),self.on_actionAbout_Qt_triggered) self.connect(self.RemoveButton, SIGNAL("clicked()"),self.on_RemoveButton_clicked) self.connect(self.RemoveButton_2, SIGNAL("clicked()"),self.on_RemoveButton_2_clicked) self.connect(self.RemoveButton_3, SIGNAL("clicked()"),self.on_RemoveButton_3_clicked) self.connect(self.ConvertButton, SIGNAL("clicked()"),self.on_ConvertButton_clicked) self.connect(self.ConvertButton_2, SIGNAL("clicked()"),self.on_ConvertButton_2_clicked) self.connect(self.actionPreferences, SIGNAL("triggered()"),self.on_actionPreferences_triggered) self.connect(self.actionAbout_video4fuze, SIGNAL("triggered()"),self.on_actionAbout_video4fuze_triggered) self.connect(self.AddButton, SIGNAL("clicked()"),self.on_AddButton_clicked) self.connect(self.AddDirButton, SIGNAL("clicked()"),self.on_AddDirButton_clicked) self.connect(self.AddButton_2, SIGNAL("clicked()"),self.on_AddButton_2_clicked) self.connect(self.SavePlaylist, SIGNAL("clicked()"),self.on_SavePlaylist_clicked) self.connect(self.SongsFromSD, SIGNAL("clicked()"),self.on_SongsFromSD_clicked) self.connect(self.SongsFromFuze, SIGNAL("clicked()"),self.on_SongsFromFuze_clicked) self.connect(self.OpenPlaylist, SIGNAL("clicked()"),self.on_OpenPlaylist_clicked) ##### self.connect(self.ToggleSort, SIGNAL("clicked()"),self.playlistWidget.sortItems) self.connect(self.SelectOutputButton, SIGNAL("clicked()"),self.SelectOutput) self.connect(self.SelectOutputButton_2, SIGNAL("clicked()"),self.SelectOutput)
def aboutApp(self): """ Zeigt die Info-Nachricht an. """ self.appText = self.tr(""" <h1>%1</h1> <h2>Version: %2</h2> <p>Copyright (C) 2011 by Victor von Rhein<br> EMail: [email protected]</p> """).arg(QCoreApplication.applicationName()).arg(QCoreApplication.applicationVersion()) self.gnuText = self.tr(""" <h2>GNU General Public License</h2> <p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p> <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p> <p>You should have received a copy of the GNU General Public License along with this program. If not, see <a>http://www.gnu.org/licenses/</a>.</p> """) self.wodText = self.tr(""" <h2>%1</h2> <p>%1, %2, the %3 and all referring terms and symbols are copyrighted by %4</p> """).arg("World of Darkness").arg("White Wolf").arg("White Wolf-Logo").arg("White Wolf Inc.") self.aboutText = self.appText + self.gnuText + self.wodText QMessageBox.about(self, "About " + QCoreApplication.applicationName(), self.aboutText )
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setFixedSize(500, 500) self.setWindowTitle(utils.tr('About MicroHex')) layout = QVBoxLayout(self) self.label = QLabel(self) self.label.setTextFormat(Qt.RichText) self.label.setText(utils.tr('MicroHex version {0}, (c) 2013 zenwarr<br><a href="{1}">{1}</a>') .format(QCoreApplication.applicationVersion(), QCoreApplication.organizationDomain())) self.label.setOpenExternalLinks(True) self.tabWidget = QTabWidget(self) self.copyingText = QTextBrowser(self) self.copyingText.setOpenExternalLinks(True) self.tabWidget.addTab(self.copyingText, utils.tr('License')) self.creditsText = QTextBrowser(self) self.creditsText.setOpenExternalLinks(True) self.tabWidget.addTab(self.creditsText, utils.tr('Credits')) l_file = QFile(':/main/data/COPYING.html') if l_file.open(QFile.ReadOnly | QFile.Text): self.copyingText.setText(str(l_file.readAll(), encoding='utf-8')) c_file = QFile(':/main/data/CREDITS.html') if c_file.open(QFile.ReadOnly | QFile.Text): self.creditsText.setText(str(c_file.readAll(), encoding='utf-8')) self.okButton = QPushButton(utils.tr('OK'), self) self.okButton.clicked.connect(self.close) self.okButton.setDefault(True) layout.addWidget(self.label) layout.addWidget(self.tabWidget) layout.addWidget(self.okButton)
def __init__(self, parent = None): """ Constructor """ QDialog.__init__(self, parent) self.setupUi(self) self.Appinfo.setText(self.Appinfo.text().replace("Info",QCoreApplication.applicationName()+" "+QCoreApplication.applicationVersion())) try: READMEfile = codecs.open("README.txt","rb", "utf-8") README = READMEfile.read() READMEfile.close() except Exception, e: README = unicode(e)