def main(): app = QApplication(sys.argv) app.setStyle('cleanlooks') app.setApplicationName("Linguistica") # Get screen resolution # Why do we need to know screen resolution? # Because this information is useful for setting the size of particular # widgets, e.g., the webview for visualizing the word neighbor manifold # (the bigger the webview size, the better it is for visualization!) resolution = app.desktop().screenGeometry() screen_width = resolution.width() screen_height = resolution.height() # create and display splash screen splash_image_path = os.path.join(os.path.dirname(__file__), 'lxa_splash_screen.png') splash_image = QPixmap(splash_image_path) splash_screen = QSplashScreen(splash_image, Qt.WindowStaysOnTopHint) splash_screen.setMask(splash_image.mask()) splash_screen.show() app.processEvents() time.sleep(2) # launch graphical user interface form = MainWindow(screen_height, screen_width, __version__) form.show() splash_screen.finish(form) app.exec_()
def nfontEditGUIStart(): app = QApplication(sys.argv) ex = NFontEditWidget('__main__') QApplication.setStyle(QStyleFactory.create('Fusion')) ex.openFile() ex.show() sys.exit(app.exec_())
def changeStyle(self, checked): if not checked: return action = self.sender() style = QStyleFactory.create(action.data()) if not style: return QApplication.setStyle(style) self.setButtonText(self.smallRadioButton, "Small (%d x %d)", style, QStyle.PM_SmallIconSize) self.setButtonText(self.largeRadioButton, "Large (%d x %d)", style, QStyle.PM_LargeIconSize) self.setButtonText(self.toolBarRadioButton, "Toolbars (%d x %d)", style, QStyle.PM_ToolBarIconSize) self.setButtonText(self.listViewRadioButton, "List views (%d x %d)", style, QStyle.PM_ListViewIconSize) self.setButtonText(self.iconViewRadioButton, "Icon views (%d x %d)", style, QStyle.PM_IconViewIconSize) self.setButtonText(self.tabBarRadioButton, "Tab bars (%d x %d)", style, QStyle.PM_TabBarIconSize) self.changeSize()
def start(): app = QApplication(sys.argv) # app.setStyle('Windows') app.setStyle('fusion') widget = MainWindow() widget.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) app.setStyle(QtWidgets.QStyleFactory.create("Fusion")) p = app.palette() p.setColor(QPalette.Base, QColor(40, 40, 40)) p.setColor(QPalette.Window, QColor(55, 55, 55)) p.setColor(QPalette.Button, QColor(49, 49, 49)) p.setColor(QPalette.Highlight, QColor(135, 135, 135)) p.setColor(QPalette.ButtonText, QColor(155, 155, 155)) p.setColor(QPalette.WindowText, QColor(155, 155, 155)) p.setColor(QPalette.Text, QColor(155, 155, 155)) p.setColor(QPalette.Disabled, QPalette.Base, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.Text, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Button, QColor(42, 42, 42)) p.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Window, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.WindowText, QColor(90, 90, 90)) app.setPalette(p) QApplication.addLibraryPath(QApplication.applicationDirPath() + "/../PlugIns") main = Window() main.setWindowTitle('Detection') main.setWindowIcon(QtGui.QIcon('assets/icon.png')) main.show() try: sys.exit(app.exec_()) except KeyboardInterrupt: pass
def main(): app = QApplication(sys.argv) app.setStyle("plastique") main = Main() main.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Fusion")) main = QMainWindow() ui = Ui_MainWindow() ui.setupUi(main) main.show() sys.exit(app.exec_())
def main(): atexit.register(Cleanup) QApplication.setStyle('Fusion') app = QApplication(sys.argv) app.setApplicationName("OCR Translator") app.setQuitOnLastWindowClosed(True) ocrtranslator = OCRTranslator() ocrtranslator.show() sys.exit(app.exec_())
def __init__(self, parent=None): super(Example, self).__init__(parent) QApplication.setStyle(QStyleFactory.create('Fusion')) # -------------- QCOMBOBOX ---------------------- cbx = QComboBox() # agregar lista de nombres de estilos disponibles cbx.addItems(QStyleFactory.keys()) # responder al evento cambio de texto cbx.currentTextChanged.connect(self.textChanged) # seleccionar el ultimo elemento cbx.setItemText(4, 'Fusion') # -------------- QLISTWIDGET --------------------- items = ['Ubuntu', 'Linux', 'Mac OS', 'Windows', 'Fedora', 'Chrome OS', 'Android', 'Windows Phone'] self.lv = QListWidget() self.lv.addItems(items) self.lv.itemSelectionChanged.connect(self.itemChanged) # -------------- QTABLEWIDGET -------------------- self.table = QTableWidget(10, 3) # establecer nombre de cabecera de las columnas self.table.setHorizontalHeaderLabels(['Nombre', 'Edad', 'Nacionalidad']) # evento producido cuando cambia el elemento seleccionado self.table.itemSelectionChanged.connect(self.tableItemChanged) # alternar color de fila self.table.setAlternatingRowColors(True) # seleccionar solo filas self.table.setSelectionBehavior(QTableWidget.SelectRows) # usar seleccion simple, una fila a la vez self.table.setSelectionMode(QTableWidget.SingleSelection) table_data = [ ("Alice", 15, "Panama"), ("Dana", 25, "Chile"), ("Fernada", 18, "Ecuador") ] # agregar cada uno de los elementos al QTableWidget for i, (name, age, city) in enumerate(table_data): self.table.setItem(i, 0, QTableWidgetItem(name)) self.table.setItem(i, 1, QTableWidgetItem(str(age))) self.table.setItem(i, 2, QTableWidgetItem(city)) vbx = QVBoxLayout() vbx.addWidget(QPushButton('Tutoriales PyQT-5')) vbx.setAlignment(Qt.AlignTop) vbx.addWidget(cbx) vbx.addWidget(self.lv) vbx.addWidget(self.table) self.setWindowTitle("Items View") self.resize(362, 320) self.setLayout(vbx)
def main(): app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Fusion")) main = Window() main.resize(950, 600) main.setWindowTitle(APP_NAME) main.show() try: sys.exit(app.exec_()) except KeyboardInterrupt: pass
def main(): sys.excepthook = excepthook settings = read_settings() if settings["Appearance"]["style"]: QApplication.setStyle(settings["Appearance"]["style"]) app = QApplication(sys.argv) if settings["Appearance"]["palette"]: app.setPalette(QPalette(QColor(settings["Appearance"]["palette"]))) IntroWindow() sys.exit(app.exec_())
def createQApplication(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 __init__(self, dataBack): QtCore.QObject.__init__(self) # Without this, the PyQt wrapper is created but the C++ object is not!!! from PyQt5.QtWidgets import QApplication, QMainWindow, QStyleFactory import sys app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Fusion")) self.mainWindow = uic.loadUi('canaconda_mainwindow.ui') self.enableButtonsSig.connect(self.enableButtons) self.dataBack = dataBack self.insertWidgets() self.mainWindow.show() sys.exit(app.exec_())
def createQApplication(app_name = 'Back In Time'): global qapp try: return qapp except NameError: pass if StrictVersion(QT_VERSION_STR) >= StrictVersion('5.6') and \ hasattr(Qt, 'AA_EnableHighDpiScaling'): QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) 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 run(): app = QApplication(sys.argv) app.setOrganizationName("manuskript") app.setOrganizationDomain("www.theologeek.ch") app.setApplicationName("manuskript") app.setApplicationVersion(_version) icon = QIcon() for i in [16, 31, 64, 128, 256, 512]: icon.addFile(appPath("icons/Manuskript/icon-{}px.png".format(i))) qApp.setWindowIcon(icon) app.setStyle("Fusion") # Load style from QSettings settings = QSettings(app.organizationName(), app.applicationName()) if settings.contains("applicationStyle"): style = settings.value("applicationStyle") app.setStyle(style) # Translation process locale = QLocale.system().name() appTranslator = QTranslator() # By default: locale translation = appPath(os.path.join("i18n", "manuskript_{}.qm".format(locale))) # Load translation from settings if settings.contains("applicationTranslation"): translation = appPath(os.path.join("i18n", settings.value("applicationTranslation"))) print("Found translation in settings:", translation) if appTranslator.load(translation): app.installTranslator(appTranslator) print(app.tr("Loaded translation: {}.").format(translation)) else: print(app.tr("Warning: failed to load translator for locale {}...").format(locale)) QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + [appPath("icons")]) QIcon.setThemeName("NumixMsk") # qApp.setWindowIcon(QIcon.fromTheme("im-aim")) # Seperating launch to avoid segfault, so it seem. # Cf. http://stackoverflow.com/questions/12433491/is-this-pyqt-4-python-bug-or-wrongly-behaving-code launch()
def run_ninja(): """First obtain the execution args and create the resources folder.""" signal.signal(signal.SIGINT, signal.SIG_DFL) # Change the process name only for linux yet is_linux = sys.platform == "darwin" or sys.platform == "win32" if is_linux: try: import ctypes libc = ctypes.cdll.LoadLibrary('libc.so.6') # Set the application name libc.prctl(PR_SET_NAME, b"%s\0" % PROCNAME, 0, 0, 0) except OSError: print("The process couldn't be renamed'") filenames, projects_path, extra_plugins, linenos, log_level, log_file = \ cliparser.parse() # Create the QApplication object before using the # Qt modules to avoid warnings app = QApplication(sys.argv) from ninja_ide import resources from ninja_ide.core import settings resources.create_home_dir_structure() # Load Logger from ninja_ide.tools.logger import NinjaLogger NinjaLogger.argparse(log_level, log_file) # Load Settings settings.load_settings() QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, settings.HDPI) if settings.CUSTOM_SCREEN_RESOLUTION: os.environ["QT_SCALE_FACTOR"] = settings.CUSTOM_SCREEN_RESOLUTION from ninja_ide import ninja_style app.setStyle(ninja_style.NinjaStyle(resources.load_theme())) from ninja_ide import gui # Start the UI gui.start_ide(app, filenames, projects_path, extra_plugins, linenos) sys.exit(app.exec_())
def setStyle(self, styleName, styleSheetFile): """ Public method to set the style of the interface. @param styleName name of the style to set (string) @param styleSheetFile name of a style sheet file to read to overwrite defaults of the given style (string) """ # step 1: set the style style = None if styleName != "System" and styleName in QStyleFactory.keys(): style = QStyleFactory.create(styleName) if style is None: style = QStyleFactory.create(self.defaultStyleName) if style is not None: QApplication.setStyle(style) # step 2: set a style sheet if styleSheetFile: try: f = open(styleSheetFile, "r", encoding="utf-8") styleSheet = f.read() f.close() except (IOError, OSError) as msg: E5MessageBox.warning( self, self.tr("Loading Style Sheet"), self.tr( """<p>The Qt Style Sheet file <b>{0}</b> could""" """ not be read.<br>Reason: {1}</p>""") .format(styleSheetFile, str(msg))) return else: styleSheet = "" e5App().setStyleSheet(styleSheet)
def style_set(self, n): QApplication.setStyle(QStyleFactory.create(n))
with open("test.csv", "w", newline='') as f: writer = csv.writer(f, delimiter=',') writer.writerow(headers) # write the header # write the actual content line by line for d in datos: writer.writerow(d) #tableWidget.doubleClicked.connect(updateTable) layout.addWidget(tableWidget) guardarB = QPushButton() guardarB.setText("Guardar") layout.addWidget(guardarB) guardarB.clicked.connect(guardar) qwidget.setLayout(layout) app.setStyle("Breeze") qwidget.show() sys.exit(app.exec_())
self.sendbutton = QPushButton('Send') #self.sendstream.setMax(100) # Layout layout = QVBoxLayout() layout.addWidget(self.sendstream) layout.addWidget(self.sendbutton) self.bottomRightGroupBox.setLayout(layout) def createBottomRightRGroupBox(self): self.bottomRightRGroupBox = QGroupBox("Received Stream") #Widgets self.receive_stream = QTextEdit() # Layout layout = QVBoxLayout() layout.addWidget(self.receive_stream) self.bottomRightRGroupBox.setLayout(layout) ########################## END GUI ########################## if __name__ == '__main__': import sys app = QApplication(sys.argv) app.setStyle('Oxygen') gallery = WidgetGallery() gallery.show() sys.exit(app.exec_()) serial.close()
def styleChanged(self, style): QApplication.setStyle(style)
frm = form_createor[self.menu_id](self) else: frm = Form_Background(self) # 尝试给窗体添加按钮,要求窗体中有一个名为 “Layout_Button”的布局 self.addButtons(frm, btns) return def closeEvent(self, *args): # 关闭主窗体前先关闭数据库游标 JPDb().close() if __name__ == "__main__": QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QApplication.setStyle('Fusion') app = QApplication(argv) db = JPDb() db.setDatabaseType(JPDbType.MySQL) MainWindow = JPMainWindow() icon = QIcon() icon.addPixmap( QPixmap(MainWindow.icoPath.format("medical_invoice_information.png"))) MainWindow.setWindowIcon(icon) MainWindow.ui.splitter.setStretchFactor(0, 2) MainWindow.ui.splitter.setStretchFactor(1, 11) # 启动数据改变事件的监听 JPPub().receiveMessage(app) MainWindow.showMaximized() sys_exit(app.exec_())
def prepare(tests=False): app = QApplication(sys.argv) app.setOrganizationName("manuskript"+("_tests" if tests else "")) app.setOrganizationDomain("www.theologeek.ch") app.setApplicationName("manuskript"+("_tests" if tests else "")) app.setApplicationVersion(getVersion()) print("Running manuskript version {}.".format(getVersion())) icon = QIcon() for i in [16, 32, 64, 128, 256, 512]: icon.addFile(appPath("icons/Manuskript/icon-{}px.png".format(i))) qApp.setWindowIcon(icon) app.setStyle("Fusion") # Load style from QSettings settings = QSettings(app.organizationName(), app.applicationName()) if settings.contains("applicationStyle"): style = settings.value("applicationStyle") app.setStyle(style) # Translation process locale = QLocale.system().name() appTranslator = QTranslator(app) # By default: locale def extractLocale(filename): # len("manuskript_") = 13, len(".qm") = 3 return filename[11:-3] if len(filename) >= 16 else "" def tryLoadTranslation(translation, source): if appTranslator.load(appPath(os.path.join("i18n", translation))): app.installTranslator(appTranslator) print(app.tr("Loaded translation from {}: {}.").format(source, translation)) return True else: print(app.tr("Note: No translator found or loaded from {} for locale {}."). format(source, extractLocale(translation))) return False # Load translation from settings translation = "" if settings.contains("applicationTranslation"): translation = settings.value("applicationTranslation") print("Found translation in settings:", translation) if (translation != "" and not tryLoadTranslation(translation, "settings")) or translation == "": # load from settings failed or not set, fallback translation = "manuskript_{}.qm".format(locale) tryLoadTranslation(translation, "system locale") QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + [appPath("icons")]) QIcon.setThemeName("NumixMsk") # Font siue if settings.contains("appFontSize"): f = qApp.font() f.setPointSize(settings.value("appFontSize", type=int)) app.setFont(f) # Main window from manuskript.mainWindow import MainWindow MW = MainWindow() # We store the system default cursor flash time to be able to restore it # later if necessary MW._defaultCursorFlashTime = qApp.cursorFlashTime() # Command line project if len(sys.argv) > 1 and sys.argv[1][-4:] == ".msk": if os.path.exists(sys.argv[1]): path = os.path.abspath(sys.argv[1]) MW._autoLoadProject = path return app, MW
def __init__(self, appName="Carla2", libPrefix=None): object.__init__(self) # try to find styles dir stylesDir = "" CWDl = CWD.lower() # standalone, installed system-wide linux if libPrefix is not None: stylesDir = os.path.join(libPrefix, "lib", "carla") # standalone, local source elif CWDl.endswith("source"): stylesDir = os.path.abspath(os.path.join(CWD, "..", "bin")) if WINDOWS: # Fixes local wine build QApplication.addLibraryPath( "C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # plugin elif CWDl.endswith("resources"): # installed system-wide linux if CWDl.endswith("/share/carla/resources"): stylesDir = os.path.abspath( os.path.join(CWD, "..", "..", "..", "lib", "carla")) # local source elif CWDl.endswith("native-plugins%sresources" % os.sep): stylesDir = os.path.abspath( os.path.join(CWD, "..", "..", "..", "..", "bin")) # other else: stylesDir = os.path.abspath(os.path.join(CWD, "..")) # everything else else: stylesDir = CWD if os.path.exists(stylesDir): QApplication.addLibraryPath(stylesDir) if WINDOWS: stylesDir = "" elif config_UseQt5: stylesDir = "" else: self._createApp(appName) return # base settings settings = QSettings("falkTX", appName) useProTheme = settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self._createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self._createApp(appName) self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue) print("Using \"%s\" theme" % self.fApp.style().objectName())
# -*- coding: utf-8 -*- # @Time : 2020/11/15 20:54 # @Author : Jaywatson # @File : main.py # @Soft : new_control import sys from PyQt5.QtWidgets import QApplication from uiImpl.mainWindowImpl import mainWindow if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle('WindowsVista') mainWindow = mainWindow() mainWindow.show() sys.exit(app.exec_())
import sys from PyQt5.QtGui import QColor, QPalette from PyQt5.QtWidgets import QApplication, QStyleFactory, QWidget from PyQt5.QtCore import Qt from MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) app.setApplicationName("Monterey") app.setApplicationVersion("1.0") app.setOrganizationName("PoliTOcean") app.setStyle(QStyleFactory.create("Fusion")) darkPalette = QPalette() darkPalette.setColor(QPalette.Window, QColor(53, 53, 53)) darkPalette.setColor(QPalette.WindowText, Qt.white) darkPalette.setColor(QPalette.Base, QColor(25, 25, 25)) darkPalette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) darkPalette.setColor(QPalette.ToolTipBase, Qt.white) darkPalette.setColor(QPalette.ToolTipText, Qt.white) darkPalette.setColor(QPalette.Text, Qt.white) darkPalette.setColor(QPalette.Button, QColor(53, 53, 53)) darkPalette.setColor(QPalette.ButtonText, Qt.white) darkPalette.setColor(QPalette.BrightText, Qt.red) darkPalette.setColor(QPalette.Link, QColor(42, 130, 218)) darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218)) darkPalette.setColor(QPalette.HighlightedText, Qt.black)
print('-x dir') elif Direction.Up: print('+y dir') self.ydev.move_abs(2016*(int(distance*5))) elif Direction.Left: print('+x dir') elif Direction.Down: print('-y dir') else: print('skat') ''' if __name__ == '__main__': # Create main application window app = QApplication([]) app.setStyle(QStyleFactory.create("Cleanlooks")) mw = QMainWindow() mw.setWindowTitle('Joystick example') # Create and set widget layout # Main widget container cw = QWidget() ml = QGridLayout() cw.setLayout(ml) mw.setCentralWidget(cw) # Create joystick joystick = Joystick() # ml.addLayout(joystick.get_joystick_layout(),0,0) ml.addWidget(joystick, 0, 0)
def initUI(self): font1 = QFont() font1.setFamily("Times New Roman") font1.setPixelSize(10) # font1.setBold(True) # font1.setItalic(True) menubar = self.menuBar() fileMenu = menubar.addMenu('File') toolMenu = menubar.addMenu('Tool') helpMenu = menubar.addMenu('Help') exitAction = QAction(QIcon('Icon/exit.ico'), 'Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.triggered.connect(qApp.quit) fileMenu.addAction(exitAction) toolAction = QAction(QIcon('Icon/backup.ico'), 'One click backup', self) toolAction.triggered.connect(self.back_up) toolMenu.addAction(toolAction) toolAction = QAction(QIcon('Icon/delete_file.ico'), 'Delete run', self) toolAction.triggered.connect(self.delete_run) toolMenu.addAction(toolAction) # toolAction = QAction(QIcon('Icon/delete_file.ico'), 'Delete run(except pj/in)', self) # toolAction.triggered.connect(self.delete_run_except_pj) # toolMenu.addAction(toolAction) # # toolAction = QAction(QIcon('Icon/delete_file.ico'), 'Delete run(extension)', self) # toolAction.triggered.connect(self.delete_run_extension) # toolMenu.addAction(toolAction) toolAction = QAction(QIcon('Icon/copy.ico'), 'Copy file', self) toolAction.triggered.connect(self.copy_file) toolMenu.addAction(toolAction) helpAction = QAction(QIcon('Icon/doc.ico'), 'User Manual', self) helpAction.setShortcut('Ctrl+H') helpAction.triggered.connect(self.user_manual) helpMenu.addAction(helpAction) self.btn_dlc1 = MyButton('One Click') self.btn_dlc1.clicked.connect(self.dlc_generator) self.btn_dlc1.setFixedHeight(25) self.btn_dlc2 = MyButton('Modify Joblist') self.btn_dlc2.clicked.connect(self.joblist_modify) self.btn_dlc2.setFixedHeight(25) self.btn_jbl1 = MyButton('From IN') self.btn_jbl1.clicked.connect(self.joblist_from_in) self.btn_jbl1.setFixedHeight(25) self.btn_jbl2 = MyButton('To Ultimate/Fatigue') # self.btn_jbl2.clicked.connect(self.joblist_trim) self.btn_jbl2.clicked.connect(self.joblist_trim) self.btn_jbl2.setFixedHeight(25) self.btn_jbl3 = MyButton('Offshore') # self.btn_jbl3.setDisabled(True) # self.btn_jbl3.setStyleSheet("QPushButton{color:black}" # "QPushButton:hover{color:red;border-style:solid}" # "QPushButton{background-color:#6E6E6E}" # "QPushButton{border:2px}" # "QPushButton{border-radius:10px}" # "QPushButton{padding:2px 4px}") self.btn_jbl3.clicked.connect(self.joblist_offshore) self.btn_jbl3.setFixedHeight(25) self.btn_che1 = MyButton('Check Simulation') self.btn_che1.clicked.connect(self.check) self.btn_che1.setFixedHeight(25) self.btn_pst1 = MyButton('Post Assistant') self.btn_pst1.clicked.connect(self.post) self.btn_pst1.setFixedHeight(25) self.btn_pst2 = MyButton('Component Loads') self.btn_pst2.clicked.connect(self.loads_output) self.btn_pst2.setFixedHeight(25) self.btn_pst3 = MyButton('Extrapolation') self.btn_pst3.clicked.connect(self.extrapolation) self.btn_pst3.setFixedHeight(25) self.btn_lst1 = MyButton('Load Summary Table') self.btn_lst1.clicked.connect(self.loadsummary) self.btn_lst1.setFixedHeight(25) self.btn_com1 = MyButton('Data Transfer') self.btn_com1.clicked.connect(self.data_transfer) self.btn_com1.setFixedHeight(25) self.btn_com2 = MyButton('One Click') self.btn_com2.clicked.connect(self.data_exchange) self.btn_com2.setFixedHeight(25) self.btn_com3 = MyButton('Post Export') self.btn_com3.clicked.connect(self.loads_output) self.btn_com3.setFixedHeight(25) self.btn_lcr1 = MyButton('Load Report') self.btn_lcr1.clicked.connect(self.load_report) self.btn_lcr1.setFixedHeight(25) # dlc generator self.vbox1 = QVBoxLayout() self.vbox1.addWidget(self.btn_dlc1) self.vbox1.addWidget(self.btn_dlc2) self.vbox1.addStretch(1) self.group1 = QGroupBox('DLC Generator') self.group1.setLayout(self.vbox1) self.group1.setFont(font1) # joblist generator self.vbox2 = QVBoxLayout() self.vbox2.addWidget(self.btn_jbl1) self.vbox2.addWidget(self.btn_jbl2) self.vbox2.addWidget(self.btn_jbl3) self.group2 = QGroupBox('Joblist Generator') self.group2.setLayout(self.vbox2) self.group2.setFont(font1) # check simulation self.vbox3 = QVBoxLayout() self.vbox3.addWidget(self.btn_che1) self.group3 = QGroupBox('Check Simulation') self.group3.setLayout(self.vbox3) self.group3.setFont(font1) # post processing self.vbox4 = QVBoxLayout() self.vbox4.addWidget(self.btn_pst3) self.vbox4.addWidget(self.btn_pst1) # self.vbox4.addWidget(self.btn_pst2) self.group4 = QGroupBox('Post Processing') self.group4.setLayout(self.vbox4) self.group4.setFont(font1) # load summary self.vbox5 = QVBoxLayout() self.vbox5.addWidget(self.btn_lst1) self.group5 = QGroupBox('Load Summary') self.group5.setLayout(self.vbox5) self.group5.setFont(font1) # components load self.vbox6 = QVBoxLayout() self.vbox6.addWidget(self.btn_com2) self.vbox6.addWidget(self.btn_com1) self.vbox6.addWidget(self.btn_com3) self.group6 = QGroupBox('Components Load') self.group6.setLayout(self.vbox6) self.group6.setFont(font1) # load report self.vbox7 = QVBoxLayout() self.vbox7.addWidget(self.btn_lcr1) self.group7 = QGroupBox('Load Calculation Report') self.group7.setLayout(self.vbox7) self.group7.setFont(font1) self.vbox_all = QVBoxLayout() self.vbox_all.addWidget(self.group1) self.vbox_all.addWidget(self.group2) self.vbox_all.addWidget(self.group3) self.vbox_all.addWidget(self.group4) self.vbox_all.addWidget(self.group5) self.vbox_all.addWidget(self.group6) self.vbox_all.addWidget(self.group7) self.vbox_all.addStretch(1) self.mywidget = QWidget() self.mywidget.setLayout(self.vbox_all) self.setCentralWidget(self.mywidget) QApplication.setStyle(QStyleFactory.create('Fusion')) # self.center() self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # self.setWindowFlags(QtCore.Qt.WindowContextHelpButtonHint|QtCore.Qt.WindowSystemMenuHint) # self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True) self.show()
Times = self.c.fetchall() for i in Times: if i[0] == self.date and i[2] == self.doctor: time.remove(i[1]) if len(time) == 0: self.Check_Label.setText('This Doctor has No Time On This Day') for i in time: self.Time_Box.addItem(i) self.conn.close() def Set_Time(self): self.appo_Button.setEnabled(True) def Set_appo(self): self.time = self.Time_Box.currentText() self.conn = sqlite3.connect("appoinment.db") self.c = self.conn.cursor() sql = "INSERT INTO appoinments (Date, Time,Doc_Name,Pat_Name) VALUES (?,?,?,?)" val = (self.date, self.time, self.doctor, self.FirstEdit.text()) print(val) self.c.execute(sql, val) self.conn.commit() self.conn.close() if __name__ == "__main__": app = QApplication(sys.argv) app.setStyle("Fusion") w = IntroWindow() w.show() sys.exit(app.exec_())
db.commit() class ProgressBarSplit(QMainWindow, Ui_pbarSplit): canceled = pyqtSignal() def __init__(self, max_orders): super(ProgressBarSplit, self).__init__() self.setupUi(self) self.pbarSplitting.setMaximum(max_orders) self.btnCancel.clicked.connect(self.cancel) def setValue(self, val): self.pbarSplitting.setValue(val) def cancel(self): self.close() self.canceled.emit() if __name__ == "__main__": myappid = 'Kornit Printing Utility' #ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) app = QApplication(sys.argv) app.setStyle("plastique") kp = KornitPrint() kp.show() kp.switch_printer_user() sys.exit(app.exec_())
def main(): parser = argparse.ArgumentParser() # first the development options --- remove later parser.add_argument('--fast', action="store_true", help="Load xmltest.txt and choose /dev/ttyUSB0 as port") parser.add_argument('--slow', action="store_true", help="Don't start the stream thread (nogui mode)") # for noGUI mode: parser.add_argument('--nogui', nargs=1, metavar='PORT', help="No GUI mode. Positional argument: port") parser.add_argument('-m', '--messages', metavar="File", help="Specify the messages file") parser.add_argument('--filter', metavar="FilterID", nargs=1, help="Comma-separated list, eg --filter='WSO100{airspeed[mph],\ wind_dir},DST800' float values must match precision") parser.add_argument('--display', nargs=1, help="Comma-separated list, eg: --display=ID,pgn,raw,body") parser.add_argument('--csv', action="store_true", help="Gives output in CSV format") parser.add_argument('--time', action="store_true", help="Time stamped output for CSV mode") parser.add_argument('--zero', action="store_true", help="Give zero-order hold output for CSV mode") parser.add_argument('--debug', action='store_true', help='Add debug buttons in GUI mode') args = parser.parse_args() # Debug print statements if (args.fast): print("Fast debug mode") # create the dataBack singleton # command line arguments passed in # refactor: choose message file in dataBack, not xmlimport dataBack = CanData(args) # begin nogui mode if args.nogui: # nogui imports import canport # '--filter' option must come with '--messages' if args.filter and not args.messages: print("\nYou are selectively displaying messages", "without specifying a way to parse CAN", "messages.\n\t(Hint: Use option -m)") return # import filters, and return a boolean value as 'filtersNotImpoted' fileName = dataBack.args.messages noMessagesImported = xmlImport(dataBack, args, fileName) # a typical usage might be something like: # ./canpython.py --nogui /dev/ttyUSB0 -m xmltest.txt --filter='WSO100{airspeed},WSO200{wind_dir=2,vel}' --slow if args.filter: filterString = args.filter[0] # createListAndDict: load filters and syntax checking. # After this call, the messageInfo_to_fields is created # and the values are lists of fields to be displayed. # Also messageInfoList is a list that contains all the # keys that are in messageInfo_to_fields. if not createListAndDict(dataBack, filterString): print("createListAndDict failed") return # The following function takes the messageInfo_to_fields # and checks for empty list in the dictionary values. # If empty, populate list with all the fields in the # meta data file. setFieldsFilterFieldDict(dataBack) # load units conversion and syntax checking: # Units conversion is set in field.unitsConversion, # which interacts with the backend.conversionMap # dictionary when a message is being parsed. if not setUnitsConversion(dataBack): print("setUnitsConversion failed") return # If the user has chosen to filter the data # by value, this function handles those # arguments: setFilterByValue(dataBack) # Now that the filters are set, # make a copy of the messageInfo_to_fields # for displaying the header in CSV mode dataBack.messageInfo_to_fields_units = dataBack.messageInfo_to_fields.copy() pdb.set_trace() # No --filter argument given, just display all the messages else: createListAndDict_noFilter(dataBack) # refactor: if args.messages and not args.csv: print("Filters to be displayed: ", str(sorted(dataBack.messageInfoList))[1:-1]) # create displayList if args.display and args.messages: for arg in args.display[0].split(','): dataBack.displayList[arg] = True else: dataBack.displayList['pgn'] = True dataBack.displayList['ID'] = True dataBack.displayList['body'] = True if noMessagesImported: print("Running CANaconda without messages specified,", "for raw message viewing") # For CSV mode: if args.csv: # Check argument syntax if not args.messages: print("Please specify a messages file.", "Use option -m") return # Setup for the CSV display else: if args.time: dataBack.CSVtimeFlag = True setDisplayCSVmode(dataBack) else: print("Opening connection to", dataBack.comport) # If --slow was given, halt program here. # Otherwise, start streaming messages. if not args.slow: # create the threading object canPort = canport.CANPort(dataBack) #start the thread serialThread = threading.Thread(target=canPort.getmessage) # find a way to intercept KeyBoardInterrupt exception # when quitting serialThread.start() ######### GUI ######### else: # Qt imports from PyQt5.QtWidgets import QApplication, QMainWindow, QStyleFactory import ui_mainwindow import canport_QT if (args.fast): # import the filters from xml xmlimport(dataBack, args, None) # create the threading object # Note: this canport is different from # the one used in the console mode. # This should be fixed. dataBack.canPort = canport_QT.CANPort_QT(dataBack) dataBack.noGui = bool(args.nogui) # aka FALSE # Start the serial thread if --fast was given as option if args.fast: serialThread = threading.Thread(target=dataBack.canPort.getmessage) # change to canport.py serialThread.daemon = True serialThread.start() # pyqt stuff app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Fusion")) #app.setQuitOnLastWindowClosed() #app.lastWindowClosed.connect(app.destroy) mainWindow = QMainWindow() ui = ui_mainwindow.Ui_MainWindow() # connect the signal to the slot if args.fast: dataBack.canPort.parsedMsgPut.connect(ui.updateUi) # call setupUi with the necessary objects ui.setupUi(mainWindow, dataBack) # run the gui mainWindow.show() sys.exit(app.exec_())
abt.addWidget(b2) # set layout self.aboutwindow.setLayout(abt) self.aboutwindow.setWindowTitle("About") self.aboutwindow.setWindowModality(Qt.ApplicationModal) self.aboutwindow.exec_() def saveFileDialog(self): # opens save file dialog try: if self.write_fs: # options = QFileDialog.Options() # options |= QFileDialog.DontUseNativeDialog home = str(Path.home()) self.save_filename, _ = QFileDialog.getSaveFileName(self,"Save","",home,"Wav Files (*.wav)") if self.save_filename: # pass # print(self.save_filename) self.save() except: self.onButtonClick("Nothing to save. Process something first") if __name__ == '__main__': # it's main. the actual program loop app = QApplication(sys.argv) base_dir = os.path.dirname(os.path.abspath(__file__)) app.setWindowIcon(QIcon(base_dir + '/STR-icon.png')) ex = App() app.setStyle('Fusion') sys.exit(app.exec_())
def style_choise(self, text): self.styleChoise.setText(text) QApplication.setStyle(QStyleFactory.create(text))
print(a) def show_datastructure(self): print("PID Select Button clicked!") PID = self.pid_lineEdit.text() def start_thread(self): thread1 = threading.Thread(target=self.profile_work) thread1.start() time.sleep(7) # p = os.popen("sc()").read() # p = os.popen("mc()").read() # p = os.popen("pc()").read() def profile_work(self): self.pushButton_6.setDisabled(True) print("Profile Select Button clicked!") combo_2 = self.comboBox_2.currentText() location = 'python2.7 volatility/vol.py --profile=' + combo_2 + ' -f ' + self.fname[0] + ' volshell' p = os.popen(location).read() command = "sc()" def quit(self): sys.exit() app = QtWidgets.QApplication(sys.argv) QApplication.setStyle("Fusion") window = MainWindow() app.exec_()
def UiSetup(self): self.original = QHBoxLayout() self.setLayout(self.original) #RIGHT SIDE KA CONSTRUCTION #RIGHT SIDE KA CONSTRUCTION self.rightLayout = QVBoxLayout() #constructing the label that keep the image or video self.imgLabel = QLabel() self.pixmap = QPixmap('Abstract.jpg') self.imgLabel.setMinimumWidth(400) self.imgLabel.setMinimumHeight(400) self.imgLabel.setMaximumWidth(800) self.imgLabel.setMaximumHeight(600) self.imgLabel.setScaledContents(True) self.imgLabel.setPixmap(self.pixmap) #setting the horizontal line separator self.hline = QHLine() #Bottom wala textArea self.textedit = QTextEdit() self.textedit.setMinimumWidth(400) self.textedit.setMinimumHeight(200) self.textedit.setMaximumWidth(800) self.textedit.setMaximumHeight(300) #right wala widget me Label(imgLabel) horizontal line and textedit dalna hai self.rightLayout.addWidget(self.imgLabel) self.rightLayout.addWidget(self.hline) self.rightLayout.addWidget(self.textedit) #LEFT SIDE KA CONSTRUCTION #LEFT SIDE KA CONSTRUCTION self.leftLayout = QVBoxLayout() self.button1 = styledButton("Open") self.button1.clicked.connect(self.button1_clicked) self.button2 = styledButton("Camera") self.button2.clicked.connect(self.button2_clicked) self.button3 = styledButton("VideoMode") self.button4 = styledButton("Process") self.button4.clicked.connect(self.button4_clicked) if self.faces != None: self.button4.setEnabled(True) else: self.button4.setEnabled(False) self.button5 = styledButton("Visulaize") if self.processed == True: self.button5.setEnabled(True) else: self.button5.setEnabled(False) #LEFT WALA ME WIDGET DALNA HAI self.leftLayout.addWidget(self.button1) self.leftLayout.addWidget(self.button2) self.leftLayout.addWidget(self.button3) self.leftLayout.addWidget(self.button4) self.leftLayout.addWidget(self.button5) self.listView = QListView() self.listView.setMinimumHeight(400) self.listView.setMaximumWidth(200) self.leftLayout.addWidget(self.listView) # VERTICAL LINE SEPARATOR self.vline = QVLine() self.original.addLayout(self.leftLayout) self.original.addWidget(self.vline) self.original.addLayout(self.rightLayout) QApplication.setStyle(QStyleFactory.create('Cleanlooks')) self.setWindowTitle('FER')
tracker=TrackingPeople() drawer = Drawer() start_time = time.time() end_time = time.time() while (1): start_time = time.time() if(start_time-end_time<0.04): while(time.time()-end_time<0.04): x=1 ret, frame = vid.read() if(not(ret)):return if gui.tracking_flag == True: trackers,detections,peopleCount=tracker.get_frame(frame) drawer.drawPedesterian(frame,trackers,detections,peopleCount) if gui.luggage_flag == True: objs = aod.get_abandoned_objs(frame) drawer.draw(frame,objs) src = drawer.cv2_to_qimage(frame) gui.changeim(src) end_time = time.time() cv2.waitKey(1) app = QApplication(sys.argv) app.setStyle('Fusion') gui = Gui() sys.exit(app.exec_())
def __init__(self, appName="Carla2", libPrefix=None): object.__init__(self) pathBinaries, pathResources = getPaths(libPrefix) # Needed for MacOS and Windows if os.path.exists(CWD) and (MACOS or WINDOWS): QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and CWD.endswith( ("source", "resources")) and os.getenv("CXFREEZE") is None: QApplication.addLibraryPath( "C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # Use binary dir as library path (except in Windows) if os.path.exists(pathBinaries) and not WINDOWS: QApplication.addLibraryPath(pathBinaries) stylesDir = pathBinaries # If style is not available we can still fake it in Qt5 elif config_UseQt5: stylesDir = "" else: self.createApp(appName) return forceTheme = MACOS or (WINDOWS and not config_UseQt5) # base settings settings = QSettings("falkTX", appName) useProTheme = forceTheme or settings.value( CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self.createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self.createApp(appName) if gCarla.nogui: return self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if forceTheme or proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue)
results in QMessageBox dialog from closeEvent, good but how/why? """ if event.key() == Qt.Key_Escape: reply = QMessageBox.question( self, "Message", "Are you sure you want to quit?", QMessageBox.Close | QMessageBox.Cancel) if reply == QMessageBox.Close: self.close() @pyqtSlot() def close_main_window(self): """ Generate 'question' dialog on clicking 'X' button in title bar. Reimplement the closeEvent() event handler to include a 'Question' dialog with options on how to proceed - Save, Close, Cancel buttons """ reply = QMessageBox.question(self, "Quit", "Are you sure you want to quit?", QMessageBox.Cancel | QMessageBox.Close) if reply == QMessageBox.Close: self.close() if __name__ == "__main__": App = QApplication(sys.argv) App.setStyle('Fusion') window = Test_window() sys.exit(App.exec())
sub.setWindowTitle("Browse") label = QLabel() label.setPixmap(pixmap) sub.setWidget(label) self.mdiArea.addSubWindow(sub) workspace.add(sub) sub.show() if __name__ == '__main__': import sys app = QApplication(sys.argv) # Set application theme app.setStyle("fusion") palette = QStyleFactory.create("Fusion").standardPalette() palette.setColor(QPalette.Window, QColor("#282D31")) palette.setColor(QPalette.Base, QColor("#404040")) palette.setColor(QPalette.Disabled, QPalette.Base, QColor("#333333")) palette.setColor(QPalette.AlternateBase, QColor(53,53,53)) palette.setColor(QPalette.Highlight, QColor(255,160,47)) palette.setColor(QPalette.WindowText, QColor("#EBEBEB")) palette.setColor(QPalette.Disabled, QPalette.WindowText, QColor("#a1a1a1")) palette.setColor(QPalette.Text, QColor("#EBEBEB")) palette.setColor(QPalette.Disabled, QPalette.Text, QColor("#a100a1")) palette.setColor(QPalette.Button, QColor(53,53,53)) palette.setColor(QPalette.Disabled, QPalette.Button, QColor("#1b1e21")) palette.setColor(QPalette.ButtonText, QColor(255,255,255)) palette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor("#a1a1a1")) palette.setColor(QPalette.Link, QColor(42, 130, 218))
api = VkApi() if api.isLogedIn(): self.track_list = VkAudio.parse(api.audio_get(api.current_user_id, api.audio_get_count(api.current_user_id))) for track in self.track_list: btn = QPushButton() btn.setText(track.artist + track.title) btn.clicked.connect(partial(self.on_track_click, track.url)) self.ui.track_list.add_widget_item(btn) self.show() def on_track_click(self, item_id): if self.track_list: for track in self.track_list: if track.url == item_id: self.ui.player_widget.prepare_playback(track) if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle("Fusion") login = LoginDialog() if not login.exec_(): sys.exit(-1) ex = ZebraApplication() sys.exit(app.exec_())
log_path = relative_path_covnert('LOG.log') file_size = os.stat(log_path).st_size if file_size > MAXIMUM_LOGFILE_SIZE: with open(log_path, 'rb') as f: file_contents = f.read() file_contents = file_contents[file_size - MAXIMUM_LOGFILE_SIZE:] with open(log_path, 'wb') as f: f.write(file_contents) tee = utils.Tee(log_path, 'a') print 'Starting: ' + str(time.time()) try: sys.stdout = tee app = QApplication(sys.argv) #app # Basic app theme here app.setStyle(QStyleFactory.create('Fusion')) app.setPalette(get_dark_palette()) # Initialize main window frmmain = Frm_Main(app) Qt_common.check_win_icon('RAM.EnhOpt.Grave.1', app, frmmain, relative_path_covnert("favicon.ico")) try: frmmain.load_file(common.DEFAULT_SETTINGS_PATH) except IOError: frmmain.show_warning_msg( 'Running for the first time? Could not load the settings file. One will be created.' ) frmmain.load_ui_common() frmmain.show() status_code = app.exec_()
def changeStyle(self, styleName): QApplication.setStyle(QStyleFactory.create(styleName)) self.changePalette()
self.setCentralWidget(tabWidget) ''' end QTabWidget ''' def tabManager(self, tabName): # 탭이 삭제되었을 때 Index 처리 ({} -> []) if tabName in self.tabWidgets: self.tabs.setCurrentIndex(self.tabWidgets.index(tabName)) else: # tab2 = QWidget() # tab2.layout = QVBoxLayout() # QLineEdit(tab2) # tab2.setLayout(tab2.layout) #self.tabs.addTab(tab2, tabName) if tabName == "결제화면": newTab = PayLayout() elif tabName == "일마감현황": newTab = WorkClosed() self.tabs.addTab(newTab, tabName) self.tabs.setCurrentIndex(self.tabs.count() - 1) # setCurrentIndex로 보여주는 탭을 변경 self.tabWidgets.append(tabName) # 리스트로 관리 if __name__ == "__main__": QApplication.setStyle('Windows') app = QApplication(sys.argv) exe = NMWindow() exe.show() sys.exit(app.exec_())
vcp = selection[0].data() print vcp self.opts.vcp = vcp self.accept() @pyqtSlot() def on_cancelButton_clicked(self): print "rejected" self.reject() @pyqtSlot() def on_fileButton_pressed(self): vcp_file = QFileDialog.getOpenFileName( self, caption="Select VCP File", directory=EXAMPLE_VCP_DIR, filter='VCP Files (*.ui *.py)', options=QFileDialog.DontUseNativeDialog) if vcp_file: self.opts.vcp = vcp_file[0] self.accept() if __name__ == '__main__': import sys app = QApplication(sys.argv) app.setStyle(QStyleFactory.create('Windows')) launcher = VCPChooser() sys.exit(app.exec_())
def __init__(self, appName = "Carla2", libPrefix = None): object.__init__(self) pathBinaries, pathResources = getPaths(libPrefix) # Needed for MacOS and Windows if os.path.exists(CWD) and (MACOS or WINDOWS): QApplication.addLibraryPath(CWD) # Needed for local wine build if WINDOWS and CWD.endswith(("frontend", "resources")) and os.getenv("CXFREEZE") is None: QApplication.addLibraryPath("C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # Use binary dir as library path (except in Windows) if os.path.exists(pathBinaries) and not WINDOWS: QApplication.addLibraryPath(pathBinaries) stylesDir = pathBinaries # If style is not available we can still fake it in Qt5 elif config_UseQt5: stylesDir = "" else: self.createApp(appName) return forceTheme = MACOS or (WINDOWS and not config_UseQt5) # base settings settings = QSettings("falkTX", appName) useProTheme = forceTheme or settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self.createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self.createApp(appName) if gCarla.nogui: return self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if forceTheme or proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue)
def style_choice(self, text): self.dropDownName = text QApplication.setStyle(QStyleFactory.create(text))
#!/usr/bin/env python import sys from PyQt5.QtWidgets import QApplication, QStyleFactory from ui import Posttid if __name__ == "__main__": application = QApplication(sys.argv) application.setStyle(QStyleFactory.create("Fusion")) window = Posttid() window.show() window.raise_() application.exec_()
pdf_islemleri = PdfIslemleri(self.baslik_sayfasi, self.tez_yolu, self.icindekiler_listesi_sayfa_numaralari, self.sekiller_listesi_sayfa_numaralari, self.cizelgeler_listesi_sayfa_numaralari, self.giris_sayfa_numaralari, self.tez_baslangic_sayfasi) tez = pdf_islemleri.Tez_Nesnesi_Olustur() hata_kontrol_nesnesi = HataKontrolleri(tez, self.tez_yolu) self.result, self.message = hata_kontrol_nesnesi.Kontrol_Baslat() print(self.result) print(type(self.result)) self.message2 = pdf_islemleri.messageBox self.addItemToListWidget() def addItemToListWidget(self): self.ui.listWidget.addItems(self.message2) self.ui.listWidget.addItem("") self.ui.listWidget.addItems(self.message) # self.ui.listWidget.addItems(self.result) print(self.result) if __name__ == '__main__': import sys app = QApplication(sys.argv) app.setStyle("fusion") loginWindow = MainWindowApp() loginWindow.show() sys.exit(app.exec_())
"""A critical error occured. Select the details to display it. Please report it to <a href='https://github.com/duniter/sakia/issues/new'>the developers github</a>""", QMessageBox.Ok, QApplication.activeWindow()) mb.setDetailedText(message) mb.setTextFormat(Qt.RichText) mb.setTextInteractionFlags(Qt.TextSelectableByMouse) mb.exec() if __name__ == '__main__': # activate ctrl-c interrupt signal.signal(signal.SIGINT, signal.SIG_DFL) sakia = QApplication(sys.argv) sys.excepthook = exception_handler sakia.setStyle('Fusion') loop = QSelectorEventLoop(sakia) loop.set_exception_handler(async_exception_handler) asyncio.set_event_loop(loop) with loop: app = Application.startup(sys.argv, sakia, loop) window = MainWindow.startup(app) loop.run_forever() try: loop.set_exception_handler(None) loop.run_until_complete(app.stop()) logging.debug("Application stopped") except asyncio.CancelledError: logging.info('CancelledError') logging.debug("Exiting")
def main(): fix_windows_stdout_stderr() if sys.version_info < (3, 4): print("You need at least Python 3.4 for this application!") sys.exit(1) urh_exe = sys.executable if hasattr(sys, 'frozen') else sys.argv[0] urh_exe = os.readlink(urh_exe) if os.path.islink(urh_exe) else urh_exe urh_dir = os.path.join(os.path.dirname(os.path.realpath(urh_exe)), "..", "..") prefix = os.path.abspath(os.path.normpath(urh_dir)) src_dir = os.path.join(prefix, "src") if os.path.exists(src_dir) and not prefix.startswith("/usr") and not re.match(r"(?i)c:\\program", prefix): # Started locally, not installed -> add directory to path sys.path.insert(0, src_dir) if len(sys.argv) > 1 and sys.argv[1] == "--version": import urh.version print(urh.version.VERSION) sys.exit(0) if GENERATE_UI and not hasattr(sys, 'frozen'): try: sys.path.insert(0, os.path.join(prefix)) from data import generate_ui generate_ui.gen() except (ImportError, FileNotFoundError): print("Will not regenerate UI, because script can't be found. This is okay in release.") from urh.util import util util.set_windows_lib_path() try: import urh.cythonext.signalFunctions import urh.cythonext.path_creator import urh.cythonext.util except ImportError: if hasattr(sys, "frozen"): print("C++ Extensions not found. Exiting...") sys.exit(1) print("Could not find C++ extensions, trying to build them.") old_dir = os.curdir os.chdir(os.path.join(src_dir, "urh", "cythonext")) from urh.cythonext import build build.main() os.chdir(old_dir) from urh.controller.MainController import MainController from urh import constants if constants.SETTINGS.value("theme_index", 0, int) > 0: os.environ['QT_QPA_PLATFORMTHEME'] = 'fusion' app = QApplication(["URH"] + sys.argv[1:]) app.setWindowIcon(QIcon(":/icons/icons/appicon.png")) util.set_icon_theme() constants.SETTINGS.setValue("default_theme", app.style().objectName()) if constants.SETTINGS.value("theme_index", 0, int) > 0: app.setStyle(QStyleFactory.create("Fusion")) if constants.SETTINGS.value("theme_index", 0, int) == 2: palette = QPalette() background_color = QColor(56, 60, 74) text_color = QColor(211, 218, 227).lighter() palette.setColor(QPalette.Window, background_color) palette.setColor(QPalette.WindowText, text_color) palette.setColor(QPalette.Base, background_color) palette.setColor(QPalette.AlternateBase, background_color) palette.setColor(QPalette.ToolTipBase, background_color) palette.setColor(QPalette.ToolTipText, text_color) palette.setColor(QPalette.Text, text_color) palette.setColor(QPalette.Button, background_color) palette.setColor(QPalette.ButtonText, text_color) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Disabled, QPalette.Text, Qt.darkGray) palette.setColor(QPalette.Disabled, QPalette.ButtonText, Qt.darkGray) palette.setColor(QPalette.Highlight, QColor(200, 50, 0)) palette.setColor(QPalette.HighlightedText, text_color) app.setPalette(palette) # use system colors for painting widget = QWidget() bg_color = widget.palette().color(QPalette.Background) fg_color = widget.palette().color(QPalette.Foreground) selection_color = widget.palette().color(QPalette.Highlight) constants.BGCOLOR = bg_color constants.LINECOLOR = fg_color constants.SELECTION_COLOR = selection_color constants.SEND_INDICATOR_COLOR = selection_color main_window = MainController() import multiprocessing as mp # allow usage of prange (OpenMP) in Processes mp.set_start_method("spawn") if sys.platform == "darwin": menu_bar = main_window.menuBar() menu_bar.setNativeMenuBar(False) elif sys.platform == "win32": # Ensure we get the app icon in windows taskbar import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("jopohl.urh") import multiprocessing as mp mp.freeze_support() main_window.showMaximized() # main_window.setFixedSize(1920, 1080 - 30) # Youtube if "autoclose" in sys.argv[1:]: # Autoclose after 1 second, this is useful for automated testing timer = QTimer() timer.timeout.connect(app.quit) timer.start(1000) return_code = app.exec_() app.closeAllWindows() os._exit(return_code) # sys.exit() is not enough on Windows and will result in crash on exit
def main(): app = QApplication(sys.argv) app.setStyle(QStyleFactory.create('Fusion')) mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
import sys from PyQt5.QtSql import QSqlDatabase from PyQt5.QtWidgets import QApplication from db.model import DatabaseModel from views.record_table import RecordTableView from views.record_form import RecordFormView from assets import resources # application and database setup application = QApplication(sys.argv) application.setStyle('Fusion') database = QSqlDatabase.addDatabase('QPSQL') database.setHostName('localhost') database.setDatabaseName('*******') database.setUserName('*******') database.setPassword('*******') assert database.open() from assets import resources from db.model import DatabaseModel from views.record_table import RecordTableView from views.record_form import RecordFormView # setup database model class OrderModel(DatabaseModel): table = 'orders' auto_populate_id = True
def on_styleCombo_activated(self, styleName): QApplication.setStyle(styleName) self.ui.applyButton.setEnabled(False)
def main(): application = QApplication(sys.argv) application.setStyle('Fusion') win = Window() win.show() sys.exit(application.exec_())
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.scene.dropped.connect(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.actionZoomFit.triggered.connect(self.zoomFit) self.actionZoomToWidth.triggered.connect(self.zoomToWidth) # Initialize variables and pointers self.box_data = [] self.pix_image = False self.image = None 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) if available_languages: 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: try: self.restoreGeometry(geometry) except TypeError: pass else: self.resize(1150, 950) state = sett.readSetting('state') if state is not None: self.restoreState(state) sp_1_state = sett.readSetting('splitter_1Sizes') if sp_1_state is not None: try: self.splitter_1.restoreState(sp_1_state) except TypeError: pass sp_2_state = sett.readSetting('splitter_2Sizes') if sp_2_state is not None: try: self.splitter_2.restoreState(sp_2_state) except TypeError: pass 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)
if not self.outputFile.text(): self.populateFileName() return if self.pdfListWidget.count() > 0: pdfMerger = PdfFileMerger() try: for i in range(self.pdfLisWidget.count()): pdfMerger.append(self.pdfListWidget.item(i).text()) pdfMerger.write(self.outputFile.text()) self.dialogMessage('Unión Completada') except Exception as e: self.dialogMessage(e) else: self.dialogMessage('No hay archivos para convertir') app = QApplication(sys.argv) app.setStyle('fusion') pdfApp = PDFApp() pdfApp.show() sys.exit(app.exec_())
def main(): if sys.version_info < (3, 4): print("You need at least Python 3.4 for this application!") sys.exit(1) t = time.time() if GENERATE_UI and not hasattr(sys, 'frozen'): try: urh_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", "..")) sys.path.append(urh_dir) sys.path.append(os.path.join(urh_dir, "src")) import generate_ui generate_ui.gen() print("Time for generating UI: %.2f seconds" % (time.time() - t)) except (ImportError, FileNotFoundError): print("Will not regenerate UI, because script can't be found. This is okay in release.") urh_exe = sys.executable if hasattr(sys, 'frozen') else sys.argv[0] urh_exe = os.readlink(urh_exe) if os.path.islink(urh_exe) else urh_exe urh_dir = os.path.join(os.path.dirname(os.path.realpath(urh_exe)), "..", "..") prefix = os.path.abspath(os.path.normpath(urh_dir)) src_dir = os.path.join(prefix, "src") if os.path.exists(src_dir) and not prefix.startswith("/usr") and not re.match(r"(?i)c:\\program", prefix): # Started locally, not installed print("Adding {0} to pythonpath. This is only important when running URH from source.".format(src_dir)) sys.path.insert(0, src_dir) from urh.util import util util.set_windows_lib_path() try: import urh.cythonext.signalFunctions import urh.cythonext.path_creator import urh.cythonext.util except ImportError: print("Could not find C++ extensions, trying to build them.") old_dir = os.curdir os.chdir(os.path.join(src_dir, "urh", "cythonext")) from urh.cythonext import build build.main() os.chdir(old_dir) from urh.controller.MainController import MainController from urh import constants if constants.SETTINGS.value("theme_index", 0, int) > 0: os.environ['QT_QPA_PLATFORMTHEME'] = 'fusion' app = QApplication(["URH"] + sys.argv[1:]) app.setWindowIcon(QIcon(":/icons/data/icons/appicon.png")) if sys.platform != "linux": # noinspection PyUnresolvedReferences import urh.ui.xtra_icons_rc QIcon.setThemeName("oxy") constants.SETTINGS.setValue("default_theme", app.style().objectName()) if constants.SETTINGS.value("theme_index", 0, int) > 0: app.setStyle(QStyleFactory.create("Fusion")) if constants.SETTINGS.value("theme_index", 0, int) == 2: palette = QPalette() background_color = QColor(56, 60, 74) text_color = QColor(211, 218, 227).lighter() palette.setColor(QPalette.Window, background_color) palette.setColor(QPalette.WindowText, text_color) palette.setColor(QPalette.Base, background_color) palette.setColor(QPalette.AlternateBase, background_color) palette.setColor(QPalette.ToolTipBase, background_color) palette.setColor(QPalette.ToolTipText, text_color) palette.setColor(QPalette.Text, text_color) palette.setColor(QPalette.Button, background_color) palette.setColor(QPalette.ButtonText, text_color) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Disabled, QPalette.Text, Qt.darkGray) palette.setColor(QPalette.Disabled, QPalette.ButtonText, Qt.darkGray) palette.setColor(QPalette.Highlight, QColor(200, 50, 0)) palette.setColor(QPalette.HighlightedText, text_color) app.setPalette(palette) main_window = MainController() if sys.platform == "darwin": menu_bar = main_window.menuBar() menu_bar.setNativeMenuBar(False) import multiprocessing as mp mp.set_start_method("spawn") # prevent errors with forking in native RTL-SDR backend elif sys.platform == "win32": # Ensure we get the app icon in windows taskbar import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("jopohl.urh") main_window.showMaximized() # main_window.setFixedSize(1920, 1080 - 30) # Youtube # use system colors for painting widget = QWidget() bgcolor = widget.palette().color(QPalette.Background) fgcolor = widget.palette().color(QPalette.Foreground) selection_color = widget.palette().color(QPalette.Highlight) constants.BGCOLOR = bgcolor constants.LINECOLOR = fgcolor constants.SELECTION_COLOR = selection_color constants.SEND_INDICATOR_COLOR = selection_color if "autoclose" in sys.argv[1:]: # Autoclose after 1 second, this is useful for automated testing timer = QTimer() timer.timeout.connect(app.quit) timer.start(1000) return_code = app.exec_() app.closeAllWindows() os._exit(return_code) # sys.exit() is not enough on Windows and will result in crash on exit
recipe = whatsfordinner.getRandomRecipe(all_recipes) home.currentRecipe = recipe home.title.setText('''<a href='''+recipe.link+'''>'''+recipe.title +'''</a>''') home.ingredients.setText(recipe.ingredients) home.title.repaint() home.ingredients.repaint() #Select the recipe that is currently displayed #Generate the shopping list, open editGUI with the shopping list def select(self): if home.currentRecipe == None: print("No recipe selected") else: home.currentRecipe.display() print("") whatsfordinner.select(home.currentRecipe) self.shoppinglistUI = editGUI.Edit("shoppinglist.txt") self.shoppinglistUI.show() #Close the GUI def exit(self): self.close() if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("cleanlooks")) home = Home() sys.exit(app.exec_())
def closeEvent(self, a0: QCloseEvent) -> None: QApplication.setStyle(QStyleFactory.create(get_configs()['window_style'])) QDialog.closeEvent(self, a0)