Example #1
0
File: dPw.py Project: kvdum/st_code
    def about(self):
        QMessageBox.about(self, QApplication.applicationDisplayName(), 
          '''<strong>{name}</strong><br>Версія: <strong>{version}</strong><br>
Copyright \N{COPYRIGHT SIGN} {organization}, {years}<br>{description}.'''.format(name=QApplication.applicationDisplayName(),
            version=QApplication.applicationVersion(), 
            organization=QApplication.organizationName(), years='2017',
            description='Програма для гідравлічного розрахунку системи опалення'))
Example #2
0
File: dPw.py Project: kvdum/st_code
 def closeEvent(self, e):
     result = QMessageBox.warning(self, QApplication.applicationDisplayName(), 
               'Зберегти дані перед закриттям?', QMessageBox.Save | \
               QMessageBox.Discard | QMessageBox.Cancel, QMessageBox.Save)
     
     if result == QMessageBox.Save:
         self.save()
         e.accept()
     elif result == QMessageBox.Discard:
         e.accept()
     else:
         e.ignore()
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = self.__class__.ui[0]()
        self.ui.setupUi(self)
        self.setWindowTitle("About")
        style = QApplication.style()

        self.ui.okBtn.clicked.connect(self.accept)
        self.ui.okBtn.setIcon(style.standardIcon(QStyle.SP_DialogOkButton))
        self.ui.aboutText.setText(
            "%s version %s." %
            (QApplication.applicationDisplayName(), version))

        logosize = self.ui.aboutText.fontMetrics().width(
            self.ui.aboutText.text())
        self.ui.knoplabLogo.setPixmap(
            QIcon(":/knoplablogo.svg").pixmap(logosize, logosize))
Example #4
0
 def showVersion(self):
     if (not self.showedVersion):
         self.showedVersion = True
         qWarning(QApplication.applicationDisplayName()+'\n'+QApplication.applicationVersion())
         self.quit = True
Example #5
0
        QTimer.singleShot(200, cont)
        self.app.run_update_report()

        # no new bug reported
        self.assertEqual(self.app.crashdb.latest_id(), 0)

        # bug was updated
        r = self.app.crashdb.download(0)
        self.assertTrue('ProcEnviron' in r)
        self.assertTrue('DistroRelease' in r)
        self.assertTrue('Uname' in r)
        self.assertEqual(r['MachineType'], 'Laptop')

        # No URL in this mode
        self.assertEqual(self.app.open_url.call_count, 0)

    def test_administrator_disabled_reporting(self):
        QTimer.singleShot(0, QCoreApplication.quit)
        self.app.ui_present_report_details(False)
        self.assertFalse(self.app.dialog.send_error_report.isVisible())
        self.assertFalse(self.app.dialog.send_error_report.isChecked())


app = QApplication(sys.argv)
app.applicationName = 'apport-kde'
app.applicationDisplayName = _('Apport')
app.windowIcon = QIcon.fromTheme('apport')

unittest.main()
Example #6
0
 def showVersion(self):
     if (not self.showedVersion):
         self.showedVersion = True
         qWarning(QApplication.applicationDisplayName() + '\n' +
                  QApplication.applicationVersion())
         self.quit = True
Example #7
0
def main():

    p = ParamGroupNode('set')

    p.add_children([{
        'name': 'x',
        'value': -1.0,
        'type': float
    }, {
        'name': 'y',
        'value': 2.0,
        'type': float
    }, {
        'name': 'z',
        'value': '=(x+y)**0.5',
        'type': float
    }, {
        'name': 'const_check',
        'value': True,
        'type': bool,
        'editable': False
    }, {
        'name': 'check',
        'value': True,
        'type': bool,
        'editable': True
    }, {
        'name': 'color',
        'value': Qt.red,
        'type': QColor
    }, {
        'name': 'color_combo',
        'value': Qt.red,
        'type': QColor,
        'validator': [QColor(Qt.red), QColor(Qt.black)]
    }, {
        'name': 'group'
    }, {
        'name': 'group.first',
        'value': 23.4,
        'type': float
    }, {
        'name': 'group.second',
        'value': 45.3,
        'type': float
    }, {
        'name': 'group.result',
        'value': '=first+second',
        'type': float
    }, {
        'name': 'group.subgroup'
    }, {
        'name': 'group.subgroup.x',
        'value': 3,
        'type': int
    }, {
        'name': 'group.subgroup.y',
        'value': '=x+extern'
    }])

    app = QApplication(sys.argv)
    app.setApplicationDisplayName(f'sparc (v{__version__})')

    model = ParamModel(p)
    model.setExpressionContext({'extern': 34})

    view = QTreeView()
    view.setModel(model)
    view.setItemDelegate(ParamDelegate(view))
    view.setWindowTitle(app.applicationDisplayName())

    view.show()

    return app.exec()
 def openClicked(self):
     dlg = QFileDialog(self)
     dlg.setDefaultSuffix("json")
     dlg.setFileMode(QFileDialog.ExistingFile)
     dlg.setAcceptMode(QFileDialog.AcceptOpen)
     dlg.setNameFilters(("JSON files (*.json)", "All files (*)"))
     if dlg.exec():
         path = dlg.selectedFiles()[0]
         try:
             with WaitCursor():
                 with open(path, 'r') as f:
                     d = json.load(f)
                     warn = None
                     if 'version' not in d:
                         warn = "The JSON configuration file does not contain a version number. It may be incompatible with this program."
                     else:
                         cversion = StrictVersion(d['version'])
                         if cversion.version[0] != jsonversion.version[0]:
                             raise BaseException("The JSON configuration file format is not compatible with this version of %s" % QApplication.applicationDisplayName())
                         elif cversion.version[1] != jsonversion.version[1]:
                             warn = "The JSON configuration file format version does not match this version of %s. Incompatibilites should be handled gracefully, but unexpected results may occur." % QApplication.applicationDisplayName()
                     if warn:
                         with TempDefaultCursor():
                             QMessageBox.warning(self, "Warning", warn)
                     self.ui.settingsTab.unserialize(d)
                     self.ui.experimentsTab.unserialize(d['experiments'])
                 self.setModified(False)
                 self.currentFileChanged.emit(path)
         except BaseException as e:
             QMessageBox.critical(self, "Error", str(e))
 def fileChanged(self, path=""):
     self.setWindowTitle(("%s[*] - " % os.path.basename(path)) + QApplication.applicationDisplayName())
Example #10
0
def test_application_display_name(app: QApplication):
    assert app is not None
    assert app.applicationDisplayName() == "Génial"