def create_app(arguments): app = QApplication(arguments) p = QPalette() p.setColor(QPalette.Window, QColor("#DDDDDD")) app.setPalette(p) keys = QStyleFactory.keys() # list of themes include: # ['Windows', 'WindowsXP', 'WindowsVista', 'Motif', 'CDE', 'Plastique', 'Cleanlooks'] # i'm using WindowsXP app.setStyle(QStyleFactory.create(keys[1])) # app.setWindowIcon(get_qicon(general_defs['icon'])) return app
def setupUi(self, QtSixAMainW): QtSixAMainW.setObjectName(_fromUtf8('QtSixAMainW')) QtSixAMainW.resize(935, 513) controller = PS3ControllerView(self) controller.show() print self.style().objectName() QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
def __init__(self, parent=None): QWidget.__init__(self, parent) # Widgets, layouts and signals self._group = QButtonGroup() layout = QGridLayout() layout.setSpacing(0) ## Element for z, position in _ELEMENT_POSITIONS.items(): widget = ElementPushButton(z) widget.setStyle(QStyleFactory.create("windows")) widget.setCheckable(True) layout.addWidget(widget, *position) self._group.addButton(widget, z) ## Labels layout.addWidget(QLabel(''), 7, 0) # Dummy layout.addWidget(QLabel('*'), 5, 2, Qt.AlignRight) layout.addWidget(QLabel('*'), 8, 2, Qt.AlignRight) layout.addWidget(QLabel('**'), 6, 2, Qt.AlignRight) layout.addWidget(QLabel('**'), 9, 2, Qt.AlignRight) for row in [0, 1, 2, 3, 4, 5, 6, 8, 9]: layout.setRowStretch(row, 1) self.setLayout(layout) # Signals self._group.buttonClicked.connect(self.selectionChanged) # Default self.setColorFunction(_category_color_function)
def setStyle(): global _system_default style = QSettings().value("guistyle", "", type("")).lower() if style not in keys(): style = _system_default if style != app.qApp.style().objectName(): app.qApp.setStyle(QStyleFactory.create(style))
def create_qapplication(app_name = 'Back In Time'): global qapp try: return qapp except NameError: pass qapp = QApplication(sys.argv + ['-title', app_name]) if os.geteuid() == 0 and \ qapp.style().objectName().lower() == 'windows' and \ 'GTK+' in QStyleFactory.keys(): qapp.setStyle('GTK+') return qapp
def __populateStyleCombo(self): """ Private method to populate the style combo box. """ curStyle = Preferences.getUI("Style") styles = QStyleFactory.keys() styles.sort() self.styleComboBox.addItem(self.trUtf8('System'), QVariant("System")) for style in styles: self.styleComboBox.addItem(style, QVariant(style)) currentIndex = self.styleComboBox.findData(QVariant(curStyle)) if currentIndex == -1: currentIndex = 0 self.styleComboBox.setCurrentIndex(currentIndex)
def loadSettings(self): s = QSettings() lang = s.value("language", "", type("")) try: index = self._langs.index(lang) except ValueError: index = 1 self.lang.setCurrentIndex(index) style = s.value("guistyle", "", type("")).lower() styles = [name.lower() for name in QStyleFactory.keys()] try: index = styles.index(style) + 1 except ValueError: index = 0 self.styleCombo.setCurrentIndex(index) self.systemIcons.setChecked(s.value("system_icons", True, bool)) self.splashScreen.setChecked(s.value("splash_screen", True, bool)) self.allowRemote.setChecked(remote.enabled())
def startmain(): """ Initialise the application and display the main window. """ app = QApplication(sys.argv) app.cleanup_files = [] QApplication.setStyle(QStyleFactory.create('CleanLooks')) QApplication.setPalette(QApplication.style().standardPalette()) QApplication.setApplicationName('Bing Wallpaper Changer') QApplication.setApplicationVersion(VERSION) QApplication.setOrganizationName('overThere.co.uk') QApplication.setWindowIcon(QIcon(':/icons/ui/ot_icon.svg')) print 'AppName: %s' % QApplication.applicationName() print 'AppVersion: %s' % QApplication.applicationVersion() print 'Company Name: %s' % QApplication.organizationName() QLocale.setDefault(QLocale(QLocale.English, QLocale.UnitedKingdom)) # Add passed arguments to app. app.args = parse_arguments() print 'Args:', app.args # Check to see if application already running. existing_pid = instance_check(app) if existing_pid: print existing_pid if app.args.quit_existing: # Command line argument passed to close existing program. Do that, then quit. if platform.system() == "Windows": subprocess.Popen("taskkill /F /T /PID %i" % existing_pid, shell=True) else: os.killpg(existing_pid, signal.SIGKILL) else: message_box_error('Program already running.', 'You can only have one copy of the Bing Wallpaper Changer running at once.') sys.exit() mainwindow = MainWindow() # mainwindow.show() sys.exit(app.exec_())
def main(argv=argv, cfg_file=cfg_file, update=1): """ The function is the client entry point. """ start_dir = os.getcwd() os.chdir(join(start_dir, dirname(argv[0]), dirname(cfg_file))) cfg_file = join(os.getcwd(), os.path.basename(cfg_file)) loadConfiguration(cfg_file) os.chdir(start_dir) path.append(config['servers']['path']) path.append(config['configobj']['path']) # this import must stay here, after the appending of configobj path to path import storage storage.init(config['storage']['path']) # this import must stay here, after the appending of configobj path to path from gui import Gui try: app = QApplication([]) app.setStyle(QStyleFactory.create("Cleanlooks")) gui = Gui(cfg_file) if not update: gui.displayWarning(PROJECT_NAME, gui._text['UpdateFail']) gui.show() exit(app.exec_()) except Exception, e: print 'Fatal Exception:', e info = getExceptionInfo() fd = open(join(config['exceptions']['save_path'], 'exception.txt'), 'a+') fd.write(info) fd.close() if config['exceptions']['send_email']: try: sendMail("DevClient fatal exception: %s" % e, info) except Exception, e: print 'Error while sending email:', e
def __init__(self, page): super(General, self).__init__(page) grid = QGridLayout() self.setLayout(grid) self.langLabel = QLabel() self.lang = QComboBox(currentIndexChanged=self.changed) grid.addWidget(self.langLabel, 0, 0) grid.addWidget(self.lang, 0, 1) self.styleLabel = QLabel() self.styleCombo = QComboBox(currentIndexChanged=self.changed) grid.addWidget(self.styleLabel, 1, 0) grid.addWidget(self.styleCombo, 1, 1) self.systemIcons = QCheckBox(toggled=self.changed) grid.addWidget(self.systemIcons, 2, 0, 1, 3) self.tabsClosable = QCheckBox(toggled=self.changed) grid.addWidget(self.tabsClosable, 3, 0, 1, 3) self.splashScreen = QCheckBox(toggled=self.changed) grid.addWidget(self.splashScreen, 4, 0, 1, 3) self.allowRemote = QCheckBox(toggled=self.changed) grid.addWidget(self.allowRemote, 5, 0, 1, 3) grid.setColumnStretch(2, 1) # fill in the language combo self._langs = ["C", ""] self.lang.addItems(('', '')) langnames = [(language_names.languageName(lang, lang), lang) for lang in po.available()] langnames.sort() for name, lang in langnames: self._langs.append(lang) self.lang.addItem(name) # fill in style combo self.styleCombo.addItem('') self.styleCombo.addItems(QStyleFactory.keys()) app.translateUI(self)
def start_main(): app = QApplication(sys.argv) icon = QIcon(':/icons/application.png') app.setWindowIcon(icon) # If compiled as a one-file PyInstaller package look for Qt4 Plugins in the TEMP folder. try: extra_path = [os.path.join(sys._MEIPASS, 'qt4_plugins')] app.setLibraryPaths(app.libraryPaths() + extra_path) app.utils_path = os.path.join(sys._MEIPASS, 'utils') except AttributeError: app.utils_path = os.path.join(os.getcwd(), 'utils') # Error handling stuff. if hasattr(sys, 'frozen'): sys.excepthook = except_hook app.setApplicationName('ABBYY Automator') app.setApplicationVersion(VERSION) app.setOrganizationName('Pearl Scan Solutions') print 'AppName: %s' % app.applicationName() print 'AppVersion: %s' % app.applicationVersion() print 'Company Name: %s' % app.organizationName() app.setStyle(QStyleFactory.create('Cleanlooks')) app.setPalette(QApplication.style().standardPalette()) if not instance_check(app): message_box_error('Program already running.', 'You can only have one copy of ABBYY Automator running at once.') sys.exit() mainwindow = MainWindow() mainwindow.show() app.exec_() app.closeAllWindows() app.quit()
def __init__(self, parent=None): QSlider.__init__(self, QtCore.Qt.Horizontal, parent) self.connect(self, SIGNAL("rangeChanged(int, int)"), self.updateRange) self.connect(self, SIGNAL("sliderReleased()"), self.movePressedHandle) self.setStyle(QStyleFactory.create('Plastique')) self.lower = 0 self.upper = 0 self.lowerPos = 0 self.upperPos = 0 self.offset = 0 self.position = 0 self.lastPressed = QxtSpanSlider.NoHandle self.upperPressed = QStyle.SC_None self.lowerPressed = QStyle.SC_None self.movement = QxtSpanSlider.FreeMovement self.mainControl = QxtSpanSlider.LowerHandle self.firstMovement = False self.blockTracking = False self.gradientLeft = self.palette().color(QPalette.Dark).light(110) self.gradientRight = self.palette().color(QPalette.Dark).light(110)
def setupUi(self, QtSixAMainW): QtSixAMainW.setObjectName(_fromUtf8('QtSixAMainW')) QtSixAMainW.resize(935, 513) triggers = TiggersView(self) triggers.show() bumpers = BumpersView(self) bumpers.show() face = FaceButtonsView(self) face.show() dpad = DpadView(self) dpad.show() select = StartSelectView(self) select.show() sixaxis = SixAxisView(self) sixaxis.show() hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(triggers) hbox.addWidget(bumpers) hbox.addWidget(dpad) hbox.addWidget(face) hbox.addWidget(select) hbox.addWidget(sixaxis) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addLayout(hbox) self.setLayout(vbox) self.progress = QProgressBar(self) self.progress.setGeometry(20, 2, 50, 20) self.progress.setTextVisible(False) self.progress.setOrientation(Qt.Vertical) self.progress.setValue(80) self.progress.move(60,28) self.progress.show() print self.style().objectName() QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
def __init__(self, engine): super(MainWidget, self).__init__() self.initUI(engine) QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
# Import resources from src import resources # lint:ok qapp = QApplication(sys.argv) qapp.setWindowIcon(QIcon(":img/logo")) # System language local = QLocale.system().name() translator = QTranslator() translator.load("qt_" + local, QLibraryInfo.location( QLibraryInfo.TranslationsPath)) qapp.installTranslator(translator) # Load services from src.gui.main_window import Pireal from src.gui import status_bar # lint:ok from src.gui import container # lint:ok from src.gui import table_widget # lint:ok from src.gui.query_editor import query_widget # lint:ok from src.gui import lateral_widget # lint:ok # Style qapp.setStyle(QStyleFactory.create("gtk")) INFO("Loading GUI...") gui = Pireal() # Style sheet with open('src/gui/style.qss') as f: qapp.setStyleSheet(f.read()) gui.show() gui.showMaximized() INFO("Pireal ready!") sys.exit(qapp.exec_())
else: self.userXm = loginParser.xm self.menuPath = loginParser.path self.loginSuccessfulSignal_NoParameters.emit() self.close() self.destroy() def mousePressEvent(self, e): self.clickPos = e.pos(); def mouseMoveEvent(self, e): self.move(e.globalPos() - self.clickPos) if __name__ == '__main__': import sys file = QFile('./qss/Coffee.qss') file.open(QFile.ReadOnly) styleSheet = file.readAll() styleSheet = str(styleSheet, encoding='utf8') app = QApplication(sys.argv) a = loginDialog() a.show() app.setStyle(QStyleFactory.create('Plastique')) qApp.setStyleSheet(styleSheet) sys.exit(app.exec_())
def keys(): return [name.lower() for name in QStyleFactory.keys()]
def main(args): app = QApplication(args) app.setStyle(QStyleFactory.create("plastique")) ex = MainWindow() ex.show() sys.exit(app.exec_())
#buttonObj.hide(); buttonObj.setStyleSheet(SpeakEasyGUI.programButtonModeTransitionStylesheet); def standardLookHandler(buttonObj): #buttonObj.show(); buttonObj.setStyleSheet(SpeakEasyGUI.programButtonStylesheet); if __name__ == "__main__": from PyQt4.QtGui import QStyleFactory, QApplication; # Create a Qt application # style = QStyleFactory.create("Plastique"); # style = QStyleFactory.create("Motif"); # style = QStyleFactory.create("GTK+"); # style = QStyleFactory.create("Windows"); style = QStyleFactory.create("Cleanlooks"); QApplication.setStyle(style); app = QApplication(sys.argv); soundPlayGui = SpeakEasyGUI(); soundPlayGui.hideButtonSignal.connect(alternateLookHandler); soundPlayGui.showButtonSignal.connect(standardLookHandler); # Enter Qt application main loop sys.exit(app.exec_());
import ui_inputdialog_value def fix_value(value, minimum, maximum): if isnan(value): print("Parameter is NaN! - %f" % value) return minimum elif value < minimum: print("Parameter too low! - %f/%f" % (value, minimum)) return minimum elif value > maximum: print("Parameter too high! - %f/%f" % (value, maximum)) return maximum else: return value QPlastiqueStyle = QStyleFactory.create("Plastique") # Custom InputDialog with Scale Points support class CustomInputDialog(QDialog, ui_inputdialog_value.Ui_Dialog): def __init__(self, parent, label, current, minimum, maximum, step, scalepoints): QDialog.__init__(self, parent) self.setupUi(self) self.label.setText(label) self.doubleSpinBox.setMinimum(minimum) self.doubleSpinBox.setMaximum(maximum) self.doubleSpinBox.setValue(current) self.doubleSpinBox.setSingleStep(step) self.ret_value = current
visibleRect.setWidth(visibleRect.width()) visibleRect.setHeight(visibleRect.height()) return visibleRect def viewScrollBarsValueChanged(self): try: self.onVisibleRectChanged.emit(QRectF(self.VisibleRect)) except Exception, err: print "EddView.viewScrollBarsValueChanged: ", err def resizeEvent(self, event): self.viewScrollBarsValueChanged() QGraphicsView.resizeEvent(self, event) if __name__ == '__main__': import os import edd.resources.resource_rc app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("plastique")) #sheetContent = open(os.path.join(os.getcwd(), 'resources/edd.stylesheet'), 'r').read() #app.setStyleSheet(sheetContent) mainWin = QMainWindow() mainWin.setCentralWidget(EWidget()) mainWin.show() sys.exit(app.exec_())
def setup_page(self): newcb = self.create_checkbox # --- Interface interface_group = QGroupBox(_("Interface")) styles = [str(txt) for txt in QStyleFactory.keys()] choices = zip(styles, [style.lower() for style in styles]) style_combo = self.create_combobox(_('Qt windows style'), choices, 'windows_style', default=self.main.default_style) single_instance_box = newcb(_("Use a single instance"), 'single_instance', tip=_("Set this to open external<br> " "Python files in an already running " "instance (Requires a restart)")) vertdock_box = newcb(_("Vertical dockwidget title bars"), 'vertical_dockwidget_titlebars') verttabs_box = newcb(_("Vertical dockwidget tabs"), 'vertical_tabs') animated_box = newcb(_("Animated toolbars and dockwidgets"), 'animated_docks') tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus', tip=_("Set this to detach any<br> " "menu from the main window")) margin_box = newcb(_("Custom dockwidget margin:"), 'use_custom_margin') margin_spin = self.create_spinbox("", "pixels", 'custom_margin', 0, 0, 30) self.connect(margin_box, SIGNAL("toggled(bool)"), margin_spin.setEnabled) margin_spin.setEnabled(self.get_option('use_custom_margin')) margins_layout = QHBoxLayout() margins_layout.addWidget(margin_box) margins_layout.addWidget(margin_spin) # Decide if it's possible to activate or not singie instance mode if os.name == 'nt': pywin32_present = programs.is_module_installed('win32api') if not pywin32_present: self.set_option("single_instance", False) single_instance_box.setEnabled(False) tip = _("This feature requires the pywin32 module.\n" "It seems you don't have it installed.") single_instance_box.setToolTip(tip) elif sys.platform == "darwin" and 'Spyder.app' in __file__: self.set_option("single_instance", True) single_instance_box.setEnabled(False) interface_layout = QVBoxLayout() interface_layout.addWidget(style_combo) interface_layout.addWidget(single_instance_box) interface_layout.addWidget(vertdock_box) interface_layout.addWidget(verttabs_box) interface_layout.addWidget(animated_box) interface_layout.addWidget(tear_off_box) interface_layout.addLayout(margins_layout) interface_group.setLayout(interface_layout) # --- Status bar sbar_group = QGroupBox(_("Status bar")) memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable', tip=self.main.mem_status.toolTip()) memory_spin = self.create_spinbox("", " ms", 'memory_usage/timeout', min_=100, max_=1000000, step=100) self.connect(memory_box, SIGNAL("toggled(bool)"), memory_spin.setEnabled) memory_spin.setEnabled(self.get_option('memory_usage/enable')) memory_layout = QHBoxLayout() memory_layout.addWidget(memory_box) memory_layout.addWidget(memory_spin) memory_layout.setEnabled(self.main.mem_status.is_supported()) cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable', tip=self.main.cpu_status.toolTip()) cpu_spin = self.create_spinbox("", " ms", 'cpu_usage/timeout', min_=100, max_=1000000, step=100) self.connect(cpu_box, SIGNAL("toggled(bool)"), cpu_spin.setEnabled) cpu_spin.setEnabled(self.get_option('cpu_usage/enable')) cpu_layout = QHBoxLayout() cpu_layout.addWidget(cpu_box) cpu_layout.addWidget(cpu_spin) cpu_layout.setEnabled(self.main.cpu_status.is_supported()) sbar_layout = QVBoxLayout() sbar_layout.addLayout(memory_layout) sbar_layout.addLayout(cpu_layout) sbar_group.setLayout(sbar_layout) # --- Debugging debug_group = QGroupBox(_("Debugging")) popup_console_box = newcb(_("Pop up internal console when internal " "errors appear"), 'show_internal_console_if_traceback', default=True) debug_layout = QVBoxLayout() debug_layout.addWidget(popup_console_box) debug_group.setLayout(debug_layout) vlayout = QVBoxLayout() vlayout.addWidget(interface_group) vlayout.addWidget(sbar_group) vlayout.addWidget(debug_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle('%s %s' % (QApplication.applicationName(), QApplication.applicationVersion())); self.config = ConfigHandler(os.path.join(os.path.expanduser('~'), '.pywv/pywv.cfg'), self) self.setStyle(QStyleFactory.create(self.config.loadStyle())) if self.config.loadStyleSheet(): self.setStyleSheet(self.config.loadStyleSheet()) else: self.setStyleSheet("* {}") # without any stylesheet, windowstyles won't apply self.setDockOptions(QMainWindow.AnimatedDocks | QMainWindow.AllowNestedDocks | QMainWindow.AllowTabbedDocks | QMainWindow.VerticalTabs); # self.dummy = QWidget(self) self.setCentralWidget(QWidget(self)) self.pBar = QProgressBar(self) self.pBar.setRange(0, self.config.loadReloadInterval()) self.pBar.setFormat("%v Sekunden") if not self.config.loadAutoload(): self.pBar.hide() self.statusBar = QStatusBar(self) self.setStatusBar(self.statusBar) self.statusBar.addWidget(self.pBar) self.reloadTimer = QTimer(self); self.reloadTimer.setInterval(self.config.loadReloadInterval() * 1000) self.connect(self.reloadTimer, SIGNAL('timeout()'), self.reload_) if self.config.loadAutoload(): self.reloadTimer.start() self.autoloadStatusTimer = QTimer(self) self.autoloadStatusTimer.setInterval(1000) # 1 sec self.connect(self.autoloadStatusTimer, SIGNAL('timeout()'), self.onAutoloadStatus) self.autoloadStatusTimer.start() self.mAction = self.menuBar().addMenu(self.tr("&Action")) self.mAction.addAction(self.tr("&update"), self.reload_, QKeySequence('F5')) self.mAction.addAction(self.tr("e&xit"), self.onExit, 'Ctrl+Q') self.mStyle = QMenu(self.tr("&Style"), self) for s in list(QStyleFactory.keys()):# // fill in all available Styles self.mStyle.addAction(s) self.connect(self.mStyle, SIGNAL('triggered(QAction*)'), self.onStyleMenu) self.mOption = self.menuBar().addMenu(self.tr("&Options")) self.mOption.addAction(self.tr("reloadinterval") , self.onReloadTime , 'F8') self.mOption.addAction(self.tr("manage links") , self.onNewLink , 'F6') self.mOption.addSeparator() self.ontopAction = QAction(self.tr("always on &top") , self) self.showTrayAction = QAction(self.tr("show tray &icon") , self) self.closeToTrayAction = QAction(self.tr("close to &tray") , self) self.autoloadAction = QAction(self.tr("auto&load") , self) self.ontopAction.setCheckable(True) self.showTrayAction.setCheckable(True) self.closeToTrayAction.setCheckable(True) self.autoloadAction.setCheckable(True) self.showTrayAction.setChecked (self.config.loadShowTray() ) self.ontopAction.setChecked (self.config.loadOntop() ) self.closeToTrayAction.setChecked(self.config.loadCloseToTray()) self.autoloadAction.setChecked (self.config.loadAutoload() ) self.connect(self.ontopAction , SIGNAL('toggled(bool)') , self.onOntopAction) self.connect(self.showTrayAction , SIGNAL('toggled(bool)') , self.onShowTrayAction) self.connect(self.closeToTrayAction , SIGNAL('toggled(bool)') , self.onCloseToTrayAction) self.connect(self.autoloadAction , SIGNAL('toggled(bool)') , self.onAutoloadAction) self.mOption.addAction(self.ontopAction) self.mOption.addAction(self.showTrayAction) self.mOption.addAction(self.closeToTrayAction) self.mOption.addAction(self.autoloadAction) self.mOption.addSeparator() self.mOption.addMenu(self.mStyle) self.trayIcon = QSystemTrayIcon(QIcon(':/appicon'), self); self.trayMgr = TrayManager(self.config, self.trayIcon) self.connect(self.trayIcon, SIGNAL('activated(QSystemTrayIcon::ActivationReason)'), self.onTrayIcon) if self.config.loadShowTray(): self.trayIcon.show() self.trayIconMenu = QMenu() self.trayIconMenu.addAction(self.tr("e&xit"), self.onExit) self.trayIcon.setContextMenu(self.trayIconMenu) self.mAbout = self.menuBar().addMenu(self.tr("&about")) self.mAbout.addAction(QApplication.applicationName(), self.onAboutAppAction) self.mAbout.addAction("Qt", self.onAboutQtAction) self.createWidgets() self.resize(self.config.loadWindowSize()) self.restoreState(self.config.loadWindowState()) if self.config.loadIsVisible(): self.show() self.reload_()
def onStyleMenu(self, a): QApplication.setStyle(QStyleFactory.create(a.text())) self.setStyle(QStyleFactory.create(a.text())) self.config.saveStyle(a.text())
self.loopers = [] self.loopers.append(LooperWidget(self.centralwidget, 0, ui_settings.looper)) self.loopers.append(LooperWidget(self.centralwidget, 1, ui_settings.looper)) for looper in self.loopers: self.verticalLayout.addWidget(looper) self.retranslateUi(SLim) def retranslateUi(self, SLim): for looper in SLim.ui.loopers: looper.retranslateUi() SLim.setWindowTitle(QApplication.translate("SLim", "MainWindow", None, QApplication.UnicodeUTF8)) class ControlMainWindow(QMainWindow): def __init__(self, parent=None): super(ControlMainWindow, self).__init__(parent) self.ui = Ui_SLim() self.ui.setupUi(self) if __name__ == "__main__": QApplication.setStyle(QStyleFactory.create("Cleanlooks")) QApplication.setPalette(QApplication.style().standardPalette()) #QApplication.setStyle(QStyleFactory.create("QtCurve")) #QApplication.setPalette(ui_palette.fPalBlue) #QApplication.setPalette(ui_palette.fPalBlack) app = QApplication(sys.argv) mySW = ControlMainWindow() mySW.show() sys.exit(app.exec_())
def interpret(self, command): """Interprets command Returns turple (output, exitCode) """ print '~~~~~~~~~ interpret' ec = pConsoleCommand.NotFound output, ec = pConsoleCommand.interpret( command) parts = self.parseCommands( command ) if parts: cmd = parts.takeFirst() else: cmd = '' if ec != pConsoleCommand.NotFound : # nothing to do pass elif cmd == "ls" : if sys.platform.startswith('win'): cmd = "dir %s" % \ " ".join(pConsoleCommand.quotedStringList(parts)).trim() else: cmd = "dir %s" % " ".join( \ pConsoleCommand.quotedStringList(parts)).trimmed() process = QProcess() process.setProcessChannelMode( QProcess.MergedChannels ) process.start( cmd ) process.waitForStarted() process.waitForFinished() output = process.readAll().trimmed() ec = process.exitCode() elif cmd == "echo" : if parts: output = "\n".join(parts) ec = pConsoleCommand.Error else: output = pConsole.tr(console, "No argument given" ) ec = pConsoleCommand.Success elif cmd == "quit": output = pConsole.tr(console, "Quitting the application..." ) ec = pConsoleCommand.Success QTimer.singleShot(1000, qApp.quit() ) elif cmd == "style" : if parts.count() != 1 : output = pConsole.tr(console, "%s take only 1 parameter, %d given" % (cmd, len(parts)) ) ec = pConsoleCommand.Error elif parts[-1] == "list" : output = pConsole.tr(console, "Available styles:\n%s" % '\n'.join(QStyleFactory.keys()) ) ec = pConsoleCommand.Success else: styleExists = parts[-1].lower() in \ [key.lower() for key in QStyleFactory.keys()] if styleExists: output = pConsole.tr(console, "Setting style to %s..." % parts[-1]) self.mMainWindow.setCurrentStyle( parts[-1] ) ec = pConsoleCommand.Success else: output = pConsole.tr(console, "This style does not exists" ) ec = pConsoleCommand.Error return (output, ec)
def __init__(self, parent=None): """ Constructor """ super(MainWindow, self).__init__(parent) self.setAttribute(Qt.WA_DeleteOnClose) QApplication.setStyle(QStyleFactory.create('cleanlooks')) self.setupUi(self) self.scene = CustomGraphicsScene() self.connect(self.scene, SIGNAL("dropped_to_scene(QString)"), self.load_image) self.graphicsView.setScene(self.scene) self.scene.installEventFilter(self) self.graphicsView.setBackgroundBrush(QBrush(Qt.gray, Qt.BDiagPattern)) quit_icon = QApplication.style().standardIcon( QStyle.SP_DialogCloseButton) self.pushButtonQuit.setIcon(quit_icon) self.setWindowTitle('Analyze & ORC image with tesseract and leptonica') self.actionZoomOut.triggered.connect(self.zoomOut) self.actionZoomIn.triggered.connect(self.zoomIn) self.actionZoomTo1.triggered.connect(self.zoomTo1) self.connect(self.actionZoomFit, SIGNAL('triggered()'), self.zoomFit) # Initialize variables and pointers self.box_data = [] self.pix_image = False self.image_width = 0 self.image_height = 0 self.tesseract = None self.api = None self.lang = 'eng' lang = sett.readSetting('language') if lang: self.lang = lang self.initialize_tesseract() if self.tesseract: available_languages = tess.get_list_of_langs(self.tesseract, self.api) for lang in available_languages: self.comboBoxLang.addItem(lang, lang) current_index = self.comboBoxLang.findData(self.lang) if current_index: self.comboBoxLang.setCurrentIndex(current_index) for idx, psm in enumerate(tess.PSM): self.comboBoxPSM.addItem(psm, idx) for idx, ril in enumerate(tess.RIL): self.comboBoxRIL.addItem(ril, idx) self.leptonica = lept.get_leptonica() if not self.leptonica: self.show_msg('Leptonica initialization failed...') # Read settings and set default values geometry = sett.readSetting('settings_geometry') if geometry is not None: self.restoreGeometry(QVariant(geometry).toByteArray()) else: self.resize(1150, 950) state = sett.readSetting('state') if state is not None: self.restoreState(QVariant(state).toByteArray()) sp_1_state = sett.readSetting('splitter_1Sizes') if sp_1_state is not None: self.splitter_1.restoreState(QVariant(sp_1_state).toByteArray()) sp_2_state = sett.readSetting('splitter_2Sizes') if sp_2_state is not None: self.splitter_2.restoreState(QVariant(sp_2_state).toByteArray()) psm = sett.readSetting('PSM') if psm: current_index = self.comboBoxPSM.findData(psm) self.comboBoxPSM.setCurrentIndex(current_index) ril = sett.readSetting('RIL') if ril: current_index = self.comboBoxRIL.findData(ril) self.comboBoxRIL.setCurrentIndex(current_index) image_name = sett.readSetting('images/last_filename') if image_name: self.image_name = image_name self.load_image(image_name) zoom_factor = sett.readSetting('images/zoom_factor') self.setZoom(zoom_factor)
def initVars(): ### Sections de la configuration EkdConfig.SECTIONS = { u"general" : _(u"Général"), u"animation_encodage_general" : _(u"Vidéo:Encodage général"), u"animation_encodage_web" : _(u"Vidéo:Encodage Web"), u"animation_encodage_hd" : _(u"Vidéo:Encodage HD"), u"animation_filtresvideo" : _(u"Vidéo:Filtres"), u"animation_montage_video_seul": _(u"Vidéo:Montage vidéo seulement"), u"animation_montage_video_et_audio": _(u"Vidéo:Montage vidéo et audio"), u"animation_decouper_une_video" : _(u"Vidéo:Découpage d'une vidéo"), u"animation_separer_audio_et_video": _(u"Vidéo:Séparation audio-vidéo"), u"animation_convertir_des_images_en_video" : _(u"Vidéo:Conversion d'images en vidéo"), u"animation_convertir_une_video_en_images" : _(u"Vidéo:Conversion d'une vidéo en images"), u"animation_reglages_divers": _(u"Vidéo:Nombre d'image par seconde"), u"animation_conversion_video_16_9_4_3" : _(u"Vidéo:Convertir une vidéo en 16/9 ou 4/3"), u"videoporamaconfig" : _(u"Vidéo:Diaporama d'images en vidéo"), u"image_planche-contact": _(u"Image:Planche contact"), u"image_changer_format": _(u"Image:Changer de format"), u"image_redimensionner" : _(u"Image:Redimension"), u"image_renommer": _(u"Image:Renommage d'images"), u"image_pour_le_web" : _(u"Image:Pour le Web "), u"image_multiplication": _(u"Image:Multiplication d'images"), u"image_filtres_image": _(u"Image:Filtres d'images"), u"image_masque_alpha_3d" : _(u"Image:Masque alpha 3D"), u"image_image_composite" : _(u"Image:Image composite"), u"image_transition_fondu" : _(u"Image:Transition fondu enchainé"), u"image_transition_spirale" : _(u"Image:Transition spirale"), u"son_musique_encodage": _(u"Audio:Transcodage audio"), u"son_joindre_multiple_fichier_audio": _(u"Audio:Joindre plusieurs fichiers audio"), u"son_decoupe_musiques_et_sons" : _(u"Audio:Découpe dans un fichier audio"), u"son_normaliser_convertir_musique_ou_son": _(u"Audio:Nomaliser et convertir un fichier audio") } ### Sections de la configuration EkdConfig.PROPERTIES = { u"charger_split": _(u"Charger la disposition des fenêtres"), u"display_mode": _(u"Mode d'affichage"), u"show_warning_messages": _(u"Voir les avertissements"), u"effacer_config": _(u"Réinitialiser la configuration"), u"boite_de_dialogue_de_fermeture": _(u"Confirmer la sauvegarde avant fermeture"), u'sauvegarder_parametres': _(u"Sauvegarder les paramêtres"), u"temporaire": _(u"Répertoire temporaire"), u"video_input_path": _(u"Répertoire de chargement des vidéos"), u"sound_input_path": _(u"Répertoire de chargement des sons"), u"image_input_path": _(u"Répertoire de chargement des images"), u"video_output_path": _(u"Répertoire de sauvegarde des vidéos"), u"sound_output_path": _(u"Répertoire de sauvegarde des sons"), u"image_output_path": _(u"Répertoire de sauvegarde des images"), u"show_hidden_files": _(u"Afficher les fichiers cachés"), u"imgmgkdir": _(u"Répertoire de ffmpeg"), u"soxdir": _(u"Répertoire de SoX"), u"mjpegtoolsdir": _(u"Répertoire de mjpegtools"), u"macromediaflashvideo": _(u"MacroMediaFlash"), u"codecmpeg1": _(u"Mpeg1"), u"codecwmv2": _(u"WMV2"), u"codecmpeg2": _(u"Mpeg2"), u"codecdivx4": _(u"Divx4"), u"codecmotionjpeg": _(u"Motion Jpeg"), u"codecoggtheora": _(u"Ogg Theora"), u"codec_vob_ffmpeg": _(u"FFMpeg"), u"mult_nbre_img_sec": _(u"Nombre d'images par seconde"), u"mult_duree_sec": _(u"Durée"), u"nbr_img_sec": _(u"Nombre d'images par seconde"), u"nbr_img_sec_mpeg1video": _(u"Nombre d'images par seconde"), u"increment": _(u"Incrémentation") , u"delai": _(u"Délai"), u"nombre_couleurs": _(u"Nomde de couleurs"), u"nombre_morceaux_horizontal": _(u"Nombre de morceaux horizontal"), u"nombre_morceaux_vertical": _(u"Nombre de morceaux vertical"), u"nouvelle_largeur": _(u"Nouvel largeur"), u"spin": _(u"Spin"), u"largeur_sans_ratio": _(u"Largeur sans ratio"), u"longueur_sans_ratio": _(u"Longueur sans ratio"), u"largeur_ratio": _(u"Largeur avec ratio"), u"valeur_bruit_luma": _(u"Valeur du bruit luma"), u"valeur_bruit_chroma": _(u"Valeur du bruit chroma"), u"luminosite": _(u"Luminosité"), u"contraste": _(u"Contraste"), u"decouper_largeur": _(u"Découper la largeur"), u"decouper_hauteur": _(u"Découper la hauteur"), u"decouper_position_largeur": _(u"Découper la position en largeur"), u"decouper_position_hauteur": _(u"Découper la position en hauteur"), u"couleur": _(u"Couleur"), u"saturation": _(u"Saturation"), u"flou_boite_rayon": _(u"Rayon du flou"), u"flou_boite_puissance": _(u"Puissance"), u"resolution_redim_largeur": _(u"Redimention largeur"), u"resolution_redim_hauteur": _(u"Redimention hauteur"), u"contraste_couleur": _(u"Contraste"), u"sepia": _(u"Sépia"), u"charcoal_traits_noirs": _(u"Traits noirs"), u"edge": _(u"Edge"), u"huile": _(u"Huile"), u"gamma": _(u"Gamma"), u"fonce_clair": _(u"Foncé clair"), u"liquidite": _(u"Liquidité"), u"bas_relief": _(u"Bas relief"), u"charcoal_crayon": _(u"Crayon charcoal"), u"spread_crayon": _(u"Crayon spread"), u"radius": _(u"Rayon"), u"sigma": _(u"Sigma"), u"precision_trait": _(u"Précision du trait"), u"largeur_trait": _(u"Largeur du trait"), u"seuillage_bas": _(u"Seuillage bas"), u"seuillage_haut": _(u"Seuillage haut"), u"intensite_du_trait": _(u"Intensité du trait"), u"reduction_couleur": _(u"Réduction de la couleur"), u"peinture_huile": _(u"Peinture à l'huile"), u"passage_image": _(u"Passage de l'image"), u"largeur_marge": _(u"Largeur de l'image"), u"nombre_images_largeur": _(u"Nombre d'images en largeur"), u"nombre_images_longueur": _(u"Nombre d'images en longueur"), u"time": _(u"Temps"), u"typet": _(u"Type transition"), u"speedt": _(u"Vitesse de transition"), u"qtstyle": _(u"Style QT"), u"codec": _(u"Codec"), u"bgcolor": _(u"Couleur de fond"), u"couleur_11": _(u"Couleur 11"), u"couleur_12": _(u"Couleur 12"), u"couleur_13": _(u"Couleur 13"), u"couleur_21": _(u"Couleur 21"), u"couleur_22": _(u"Couleur 22"), u"couleur_23": _(u"Couleur 23"), u"couleur_31": _(u"Couleur 31"), u"couleur_32": _(u"Couleur 32"), u"couleur_33": _(u"Couleur 33"), u"taille_mini_forme": _(u"Taille minimale"), u"taille_maxi_forme": _(u"Taille maximale"), u"coul_omb_lum_a_la_coul_11": _(u"Ombre Couleur 11"), u"coul_omb_lum_a_la_coul_12": _(u"Ombre Couleur 12"), u"coul_omb_lum_a_la_coul_21": _(u"Ombre Couleur 21"), u"coul_omb_lum_a_la_coul_22": _(u"Ombre Couleur 22"), u"coul_omb_lum_a_la_coul_31": _(u"Ombre Couleur 31"), u"coul_omb_lum_a_la_coul_32": _(u"Ombre Couleur 32"), u"coul_omb_lum_a_la_coul_41": _(u"Ombre Couleur 41"), u"coul_omb_lum_a_la_coul_42": _(u"Ombre Couleur 42"), u"coul_contour_couleur_00": _(u"Contour couleur 00"), u"coul_contour_couleur_11": _(u"Contour couleur 11"), u"coul_contour_couleur_12": _(u"Contour couleur 12"), u"coul_contour_couleur_13": _(u"Contour couleur 13"), u"coul_contour_couleur_21": _(u"Contour couleur 21"), u"coul_contour_couleur_22": _(u"Contour couleur 22"), u"coul_contour_couleur_23": _(u"Contour couleur 23"), u"coul_contour_couleur_31": _(u"Contour couleur 31"), u"coul_contour_couleur_32": _(u"Contour couleur 32"), u"coul_contour_couleur_33": _(u"Contour couleur 33"), u"coul_contour_couleur_41": _(u"Contour couleur 41"), u"coul_contour_couleur_42": _(u"Contour couleur 42"), u"coul_contour_couleur_43": _(u"Contour couleur 43"), u"ignore_case": _(u"Tri sensible à la casse"), u"interval_speed": _(u"Vitesse de lecture des images (ms)") } ## Chk ne peut pas être enlevé car utilisé dans vidéoporama, il faut supprimer les référence de cette ## option dans videoporama avant de pouvoir la retirer - Travail effectué -> chk retiré EkdConfig.PROPERTIES_MASK = [ u"sources", u"codec", u"chk", u"sauvegarder_parametres" ] if os.name == 'nt': EkdConfig.PROPERTIES_MASK.extend([u"imgmgkdir", u"mjpegtoolsdir", u"soxdir", u"show_hidden_files"]) EkdConfig.SECTION_MASK = [ u"animation_encodage_general", u"animation_encodage_web", u"animation_encodage_hd", u"animation_filtresvideo", u"animation_montage_video_seul", u"animation_montage_video_et_audio", u"animation_decouper_une_video" , u"animation_separer_audio_et_video", u"animation_convertir_des_images_en_video" , u"animation_convertir_une_video_en_images", u"animation_reglages_divers", u"animation_conversion_video_16_9_4_3", u"image_planche-contact", u"image_changer_format", u"image_redimensionner", u"image_renommer",u"image_image_composite", u"image_transition_fondu", u"image_transition_spirale", u"image_pour_le_web", u"image_multiplication", u"image_filtres_image", u"image_masque_alpha_3d", u"son_musique_encodage", u"son_joindre_multiple_fichier_audio", u"son_decoupe_musiques_et_sons", u"son_normaliser_convertir_musique_ou_son" ] EkdConfig.BOOLEAN_PROPERTIES = [ u"charger_split", u"effacer_config", u"boite_de_dialogue_de_fermeture", u'sauvegarder_parametres', u"show_hidden_files", u"show_warning_messages", u"ignore_case" ] EkdConfig.STYLE_PROPERTIES = { u"qtstyle": map(str, QStyleFactory.keys()), u"codec" : ['copie', 'avirawsanscompression', 'codec_dv_ffmpeg', 'codec_mov_ffmpeg', 'codec_hfyu_ffmpeg', 'codecmotionjpeg', 'codecoggtheora', 'codec_vob_ffmpeg', 'codecmpeg2', 'codech264mpeg4', 'codech264mpeg4_ext_h264', 'codecxvid', 'codecdivx4', 'codecmpeg1', 'macromediaflashvideo', 'codecwmv2', 'codec_3GP_ffmpeg', 'codec_AMV_ffmpeg'], u"display_mode": [ "auto", "1280x800", "1024x768", "1024x600", "800x600", "800x480"] } EkdConfig.CODEC_PROPERTIES = { u"speedt": [u'Très lent', u'Lent', u'Moyen', u'Moyen+', u'Rapide', u'Très rapide'], u"typet": [u'Aucun', u'Fondu', u'Apparaît', u'Disparaît', u'Slide', u'Cube', u'Pousser', u'Luma' ] } EkdConfig.PATH_PROPERTIES = [ u"temporaire", u"video_input_path", u"sound_input_path", u"image_input_path", u"video_output_path", u"sound_output_path", u"image_output_path", u"imgmgkdir", u"soxdir", u"mjpegtoolsdir"] EkdConfig.COLOR_PROPERTIES = [ u"bgcolor", u"couleur_11", u"couleur_12", u"couleur_13", u"couleur_21", u"couleur_22", u"couleur_23", u"couleur_31", u"couleur_32", u"couleur_33", u"taille_mini_forme", u"taille_maxi_forme", u"coul_omb_lum_a_la_coul_11", u"coul_omb_lum_a_la_coul_12", u"coul_omb_lum_a_la_coul_21", u"coul_omb_lum_a_la_coul_22", u"coul_omb_lum_a_la_coul_31", u"coul_omb_lum_a_la_coul_32", u"coul_omb_lum_a_la_coul_41", u"coul_omb_lum_a_la_coul_42", u"coul_contour_couleur_00", u"coul_contour_couleur_11", u"coul_contour_couleur_12", u"coul_contour_couleur_13", u"coul_contour_couleur_21", u"coul_contour_couleur_22", u"coul_contour_couleur_23", u"coul_contour_couleur_31", u"coul_contour_couleur_32", u"coul_contour_couleur_33", u"coul_contour_couleur_41", u"coul_contour_couleur_42", u"coul_contour_couleur_43"] EkdConfig.NUM_PROPERTIES = [ u"macromediaflashvideo", u"codecmpeg1", u"codecmpeg2", u"codecdivx4", u"codecwmv2", u"codecmotionjpeg", u"codecoggtheora", u"codec_vob_ffmpeg", u"mult_nbre_img_sec", u"mult_duree_sec", u"nbr_img_sec", u"nbr_img_sec_mpeg1video", u"increment", u"delai", u"nombre_couleurs", u"nombre_morceaux_horizontal", u"nombre_morceaux_vertical", u"nouvelle_largeur", u"spin", u"largeur_sans_ratio", u"longueur_sans_ratio", u"largeur_ratio", u"valeur_bruit_luma", u"valeur_bruit_chroma", u"luminosite", u"contraste", u"decouper_largeur", u"decouper_hauteur", u"decouper_position_largeur", u"decouper_position_hauteur", u"couleur", u"saturation", u"flou_boite_rayon", u"flou_boite_puissance", u"resolution_redim_largeur", u"resolution_redim_hauteur", u"contraste_couleur", u"sepia", u"charcoal_traits_noirs", u"edge", u"huile", u"gamma", u"fonce_clair", u"liquidite", u"bas_relief", u"charcoal_crayon", u"spread_crayon", u"radius", u"sigma", u"precision_trait", u"largeur_trait", u"seuillage_bas", u"seuillage_haut", u"intensite_du_trait", u"reduction_couleur", u"peinture_huile", u"passage_image", u"largeur_marge", u"nombre_images_largeur", u"nombre_images_longueur", u"time" ] EkdConfig.TIME_PROPERTIES = [ u"interval_speed" ]
def setStyle(): style = QSettings().value("guistyle", "", type("")).lower() if style not in keys(): style = _system_default if style != app.qApp.style().objectName(): app.qApp.setStyle(QStyleFactory.create(style))
from PyQt4 import QtCore, QtGui from PyQt4.QtGui import QApplication, \ QStyleFactory from PyQt4.QtCore import QTranslator from ui.domotica_client import DomoticaClient from ui.admin_home_map import AdminHomeMap app = QtGui.QApplication(sys.argv) QApplication.setStyle(QStyleFactory.create('Cleanlooks')) # QApplication.setStyle(QStyleFactory.create('plastique')) trs = ['es','us'] def_tr = 'us' for i in range(len(sys.argv)): v = sys.argv[i] if v in ('-lang','--lang'): if (i < len(sys.argv)-1): v = sys.argv[i+1] if v in trs: def_tr = v tr = QTranslator()