def quantyModuleInit(self): # Load components related to the Quanty module. self.quantyDockWidget = QuantyDockWidget(self) self.addDockWidget(Qt.RightDockWidgetArea, self.quantyDockWidget) self.quantyDockWidget.setVisible(True) # Menu. icon = QIcon( resourceFileName('crispy:' + os.path.join('gui', 'icons', 'cog.svg'))) self.quantyOpenPreferencesDialogAction.setIcon(icon) self.quantyOpenPreferencesDialogAction.triggered.connect( self.quantyOpenPreferencesDialog) icon = QIcon( resourceFileName('crispy:' + os.path.join('gui', 'icons', 'save.svg'))) self.quantySaveInputAction.setIcon(icon) self.quantySaveInputAction.triggered.connect( self.quantyDockWidget.saveInput) self.quantySaveInputAsAction.triggered.connect( self.quantyDockWidget.saveInputAs) self.quantySaveCalculationsAsAction.setIcon(icon) self.quantySaveCalculationsAsAction.triggered.connect( self.quantyDockWidget.saveCalculationsAs) icon = QIcon( resourceFileName('crispy:' + os.path.join('gui', 'icons', 'trash.svg'))) self.quantyRemoveCalculationsAction.setIcon(icon) self.quantyRemoveCalculationsAction.triggered.connect( self.quantyDockWidget.removeCalculations) icon = QIcon( resourceFileName('crispy:' + os.path.join('gui', 'icons', 'folder-open.svg'))) self.quantyLoadCalculationsAction.setIcon(icon) self.quantyLoadCalculationsAction.triggered.connect( self.quantyDockWidget.loadCalculations) self.quantyRunCalculationAction.triggered.connect( self.quantyDockWidget.runCalculation) self.quantyMenuUpdate(False) self.quantyModuleShowAction.triggered.connect(self.quantyModuleShow) self.quantyModuleHideAction.triggered.connect(self.quantyModuleHide) # Preferences dialog. self.preferencesDialog = QuantyPreferencesDialog(self)
def template(self): subshell = self.parameters['subshell'] symmetry = self.parameters['symmetry'] experiment = self.parameters['experiment'] edge = self.parameters['edge'] edge = re.search(r'\((.*?)\)', edge).group(1) templateName = '{}_{}_{}_{}.lua'.format( subshell, symmetry, experiment, edge) templatePath = resourceFileName('quanty:templates/{}'.format( templateName)) with open(templatePath) as fp: return fp.read()
def suite(): test_suite = unittest.TestSuite() tests = OrderedDict() with open(resourceFileName('quanty:test/tests/manifest.csv')) as fp: reader = csv.DictReader(fp, quotechar='"', quoting=csv.QUOTE_ALL, skipinitialspace=True) for line in reader: index = line['index'] line.pop('index', None) tests[index] = line for test in tests: parameters = tests[test] test_suite.addTest(parameterize(TestQuanty, test, parameters)) return test_suite
def __init__(self, parent): super(AboutDialog, self).__init__(parent) config = Config() self.settings = config.read() path = resourceFileName('uis:about.ui') loadUi(path, baseinstance=self, package='crispy.gui') self.nameLabel.setText('Crispy {}'.format(version)) if self.settings: updateCheck = self.settings.value('CheckForUpdates') if updateCheck is None: updateCheck = 1 self.updateCheckBox.setChecked(int(updateCheck)) self.updateCheckBox.stateChanged.connect( self.updateCheckBoxStateChanged) self.settings.setValue('CheckForUpdates', updateCheck) self.settings.sync() self.runUpdateCheck()
def __init__(self): super(MainWindow, self).__init__() uiPath = resourceFileName('uis:main.ui') loadUi(uiPath, baseinstance=self, package='crispy.gui') # Main window. self.statusbar.showMessage('Ready') # Logger widget. font = QFontDatabase.systemFont(QFontDatabase.FixedFont) if sys.platform == 'darwin': font.setPointSize(font.pointSize() + 1) self.loggerWidget.setFont(font) self.loggerWidget.setLineWrapMode(QPlainTextEdit.NoWrap) # About dialog. self.aboutDialog = AboutDialog(parent=self) self.openAboutDialogAction.triggered.connect(self.openAboutDialog) # Quanty module. self.quantyModuleInit()
def __init__(self, parent): super(UpdateAvailableDialog, self).__init__(parent) path = resourceFileName('uis:update.ui') loadUi(path, baseinstance=self, package='crispy.gui')