class _PenshowerConfigurePanelWidget(_ConfigurePanelWidget): def _initUI(self): # Widgets self._brw_pendbase = DirBrowseWidget() self._brw_exe = FileBrowseWidget() if os.name == 'nt': self._brw_exe.setNameFilter('Application files (*.exe)') else: self._brw_exe.setNameFilter('Application files (*)') # Layouts layout = _ConfigurePanelWidget._initUI(self) layout.addRow("Path to pendbase directory", self._brw_pendbase) layout.addRow('Path to PENSHOWER executable', self._brw_exe) # Signals self._brw_pendbase.pathChanged.connect(self._onPathChanged) self._brw_exe.pathChanged.connect(self._onPathChanged) return layout def _onPathChanged(self, path): if not path: return if not self._brw_pendbase.baseDir(): self._brw_pendbase.setBaseDir(path) if not self._brw_exe.baseDir(): self._brw_exe.setBaseDir(path) def hasAcceptableInput(self): if not self._brw_pendbase.path(): return False if not self._brw_exe.path(): return False if not os.access(self._brw_exe.path(), os.X_OK): return False return True def setSettings(self, settings): if 'penshower' in settings: path = getattr(settings.penshower, 'pendbase', None) try: self._brw_pendbase.setPath(path) except ValueError: pass path = getattr(settings.penshower, 'exe', None) try: self._brw_exe.setPath(path) except ValueError: pass def updateSettings(self, settings): section = _ConfigurePanelWidget.updateSettings(self, settings) section.pendbase = self._brw_pendbase.path() section.exe = self._brw_exe.path() return section
class _PenepmaConfigurePanelWidget(_ConfigurePanelWidget): def _initUI(self): # Widgets self._brw_pendbase = DirBrowseWidget() self._brw_exe = FileBrowseWidget() if os.name == 'nt': self._brw_exe.setNameFilter('Application files (*.exe)') else: self._brw_exe.setNameFilter('Application files (*)') self._spn_dumpp = QSpinBox() self._spn_dumpp.setMinimum(30) self._spn_dumpp.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) # Layouts layout = _ConfigurePanelWidget._initUI(self) layout.addRow("Path to pendbase directory", self._brw_pendbase) layout.addRow('Path to PENEPMA executable', self._brw_exe) layout.addRow('Interval between dump (s)', self._spn_dumpp) # Signals self._brw_pendbase.pathChanged.connect(self._onPathChanged) self._brw_exe.pathChanged.connect(self._onPathChanged) return layout def _onPathChanged(self, path): if not path: return if not self._brw_pendbase.baseDir(): self._brw_pendbase.setBaseDir(path) if not self._brw_exe.baseDir(): self._brw_exe.setBaseDir(path) def hasAcceptableInput(self): if not self._brw_pendbase.path(): return False if not self._brw_exe.path(): return False if not os.access(self._brw_exe.path(), os.X_OK): return False return True def setSettings(self, settings): if 'penepma' in settings: path = getattr(settings.penepma, 'pendbase', None) try: self._brw_pendbase.setPath(path) except ValueError: pass path = getattr(settings.penepma, 'exe', None) try: self._brw_exe.setPath(path) except ValueError: pass try: dumpp = int(getattr(settings.penepma, 'dumpp', 30)) self._spn_dumpp.setValue(dumpp) except (TypeError, ValueError): pass def updateSettings(self, settings): section = _ConfigurePanelWidget.updateSettings(self, settings) section.pendbase = self._brw_pendbase.path() section.exe = self._brw_exe.path() section.dumpp = int(self._spn_dumpp.value()) return section
class _MonacoConfigurePanelWidget(_ConfigurePanelWidget): def _initUI(self): # Widgets self._brw_basedir = DirBrowseWidget() self._brw_exe = FileBrowseWidget() if os.name == 'nt': self._brw_exe.setNameFilter('Application files (*.exe)') else: self._brw_exe.setNameFilter('Application files (*)') # Layouts layout = _ConfigurePanelWidget._initUI(self) layout.addRow('Full path to base directory', self._brw_basedir) layout.addRow('Full path to Mccli32.exe (optional)', self._brw_exe) # Signals self._brw_basedir.pathChanged.connect(self._onPathChanged) self._brw_exe.pathChanged.connect(self._onPathChanged) return layout def _onPathChanged(self, path): if not path: return if not self._brw_basedir.baseDir(): self._brw_basedir.setBaseDir(path) if not self._brw_exe.baseDir(): self._brw_exe.setBaseDir(path) def hasAcceptableInput(self): basedir = self._brw_basedir.path() if not basedir: return False mccli32_exe = self._brw_exe.path() if not mccli32_exe: mccli32_exe = os.path.join(basedir, 'Mccli32.exe') if not os.path.isfile(mccli32_exe): return False return True def setSettings(self, settings): if 'monaco' in settings: path = getattr(settings.monaco, 'basedir', None) try: self._brw_basedir.setPath(path) except ValueError: pass path = getattr(settings.monaco, 'exe', None) try: self._brw_exe.setPath(path) except ValueError: pass def updateSettings(self, settings): section = _ConfigurePanelWidget.updateSettings(self, settings) section.basedir = self._brw_basedir.path() section.exe = self._brw_exe.path() or \ os.path.join(self._brw_basedir.path(), 'Mccli32.exe') return section