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(): 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 setupApplication(): app = QApplication(sys.argv) #app.aboutToQuit.connect(appExitHandler) darkPalette = QPalette() darkPalette.setColor(QPalette.Window, QColor(0, 0, 0)) darkPalette.setColor(QPalette.WindowText, Qt.white) darkPalette.setColor(QPalette.Base, QColor(25, 25, 25)) darkPalette.setColor(QPalette.AlternateBase, QColor(0, 0, 0)) darkPalette.setColor(QPalette.ToolTipBase, Qt.white) darkPalette.setColor(QPalette.ToolTipText, Qt.white) darkPalette.setColor(QPalette.Text, Qt.white) darkPalette.setColor(QPalette.Button, QColor(0, 0, 0)) darkPalette.setColor(QPalette.ButtonText, Qt.black) 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) app.setPalette(darkPalette) app.setStyleSheet("QScrollBar:vertical {background-color: black} QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none;}") return app
PALETTE.setColor(QPalette.Base, QColor(45, 45, 45)) PALETTE.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) PALETTE.setColor(QPalette.ToolTipBase, Qt.white) PALETTE.setColor(QPalette.ToolTipText, Qt.white) PALETTE.setColor(QPalette.Text, Qt.white) PALETTE.setColor(QPalette.Button, QColor(53, 53, 53)) PALETTE.setColor(QPalette.ButtonText, Qt.white) PALETTE.setColor(QPalette.BrightText, Qt.red) PALETTE.setColor(QPalette.Link, QColor(*ACCENT_COLOR)) PALETTE.setColor(QPalette.Highlight, QColor(*ACCENT_COLOR)) PALETTE.setColor(QPalette.HighlightedText, Qt.black) APP.setStyleSheet(f""" QToolTip {{ color: #ffffff; background-color: #2d2d2d; border: 1px solid #{ACCENT_COLOR[0]:02x}{ACCENT_COLOR[1]:02x}{ACCENT_COLOR[2]:02x}; }} /* QFrame::HLine, QFrame::VLine */ QFrame[frameShape="4"][frameShadow="48"], QFrame[frameShape="5"][frameShadow="48"] {{ background-color: #2d2d2d; }} """) APP.setPalette(PALETTE) WINDOW.show() sys.exit(APP.exec_())
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": VERSION = "2.7.5" print(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): # The generate UI script cannot be found so we are most likely in release mode, no problem here. pass from urh.util import util util.set_shared_library_path() try: import urh.cythonext.signal_functions 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.path.realpath(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(["Wector"] + sys.argv[1:]) app.setWindowIcon(QIcon(":/icons/icons/appicon.png")) try: app.styleHints().setShowShortcutsInContextMenus(True) except AttributeError: pass util.set_icon_theme() font_size = constants.SETTINGS.value("font_size", 0, int) if font_size > 0: font = app.font() font.setPointSize(font_size) app.setFont(font) 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() # allow usage of prange (OpenMP) in Processes # multiprocessing.set_start_method("spawn") if 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.showFullScreen() # 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() #-------------------------- remove files in directory, when You close the application from PyQt5.QtCore import QDir path = QDir.currentPath() os.chdir(path) for file in glob.glob("*.wav"): os.remove(path + "/" + file) #------------------------------------------------------------------------------------ os._exit( return_code ) # sys.exit() is not enough on Windows and will result in crash on exit
class QtManager: def __init__(self, imports): self.app = QApplication([]) self.window = QWidget() # Set window look self.window.setWindowTitle('Stock Tools') self.window.setFixedSize(1500, 1000) self.set_dark_theme() ########################### # Add tabs and style them # ########################### vbox = QVBoxLayout() ts = self.return_stylesheet('../styles/dark_tabs.css') tab_widget = QTabWidget() tab_widget.setAutoFillBackground(True) tab_widget.setStyleSheet(ts) tab_widget.addTab( UpComingEarningsScannerTab(imports['UpcomingEarningsScanner']), 'Upcoming Earnings Scanner') tab_widget.addTab(TwitterSentimentAnalysis(), 'Twitter Sentiment Analysis') tab_widget.addTab(ShortInterestParser(), 'Short Interest Parser') vbox.addWidget(tab_widget) # Add widget layout to window self.window.setLayout(vbox) def run_app(self): self.window.show() self.app.exec_() def set_dark_theme(self): dark_palette = QPalette() dark_palette.setColor(QPalette.Window, QColor(53, 53, 53)) dark_palette.setColor(QPalette.WindowText, Qt.darkRed) dark_palette.setColor(QPalette.Base, QColor(25, 25, 25)) dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ToolTipBase, Qt.white) dark_palette.setColor(QPalette.ToolTipText, Qt.white) dark_palette.setColor(QPalette.Text, Qt.darkRed) dark_palette.setColor(QPalette.Button, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ButtonText, Qt.darkRed) dark_palette.setColor(QPalette.BrightText, Qt.red) dark_palette.setColor(QPalette.Link, QColor(42, 130, 218)) dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) dark_palette.setColor(QPalette.HighlightedText, Qt.black) self.app.setPalette(dark_palette) @staticmethod def return_stylesheet(filename): with open(filename, 'r') as f: return f.read()
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) 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") import multiprocessing as mp mp.freeze_support() 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
def getPalette(): palette = QPalette() palette.setColor(QPalette.Window, QColor(53, 53, 53)) palette.setColor(QPalette.WindowText, Qt.white) palette.setColor(QPalette.Base, QColor(25, 25, 25)) palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) palette.setColor(QPalette.ToolTipBase, QColor(25, 25, 25)) palette.setColor(QPalette.ToolTipText, Qt.white) palette.setColor(QPalette.Text, Qt.white) palette.setColor(QPalette.Button, QColor(53, 53, 53)) palette.setColor(QPalette.ButtonText, Qt.white) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Link, QColor(42, 130, 218)) palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) palette.setColor(QPalette.HighlightedText, Qt.black) return palette if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('configFileName', default='.secret_config.js', nargs='?', help='Configuration file') args = parser.parse_args() cfg = ConfigManager.fromFile(args.configFileName) app = QApplication(sys.argv) app.setPalette(getPalette()) window = MainWindow(cfg) window.show() app.exec_()
def run(): app = QApplication(sys.argv) app.setPalette(dark_paletter()) mainwindow = MainWindow() mainwindow.show() return app.exec_()
def change_palette(self): if self.standard_palette.isChecked(): QApplication.setPalette(QApplication.style().standardPalette()) else: QApplication.setPalette(self.original_palette)
def __init__(self, parent=None, imageoperator=None): super(MainGUI, self).__init__(parent) self.inputfile = None self.batchfilenames = None self.imageoperator = imageoperator self.originalPalette = QApplication.palette() self.btnFileOpen = QPushButton("Choose image file...") self.btnFileOpen.clicked.connect(self.getfile) self.leInputImage = QLabel() self.leInputImage.setPixmap( QPixmap( os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', 'resources', 'emptyspace.png'))).scaledToHeight(400)) self.leOutputImage = QLabel() self.leOutputImage.setPixmap( QPixmap( os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', 'resources', 'emptyspace.png'))).scaledToHeight(400)) self.createBottomLeftTabWidget() self.createBottomRightTabWidget() self.createProgressBar() # Top row of GUI, with image displays topLeftLayout = QGroupBox("Input Image") layout = QVBoxLayout() layout.addWidget(self.leInputImage) layout.addWidget(self.btnFileOpen) layout.addStretch(1) topLeftLayout.setLayout(layout) topRightLayout = QGroupBox("Output Image") layout = QVBoxLayout() layout.addWidget(self.leOutputImage) layout.addStretch(1) topRightLayout.setLayout(layout) topLayout = QHBoxLayout() topLayout.addWidget(topLeftLayout) topLayout.addWidget(topRightLayout) # Bottom row of GUI, with processing functions bottomLeftLayout = QGroupBox("Processing") layout = QVBoxLayout() layout.addWidget(self.bottomLeftTabWidget) layout.addStretch(1) bottomLeftLayout.setLayout(layout) bottomRightLayout = QGroupBox("Results") layout = QVBoxLayout() layout.addWidget(self.bottomRightTabWidget) layout.addStretch(1) bottomRightLayout.setLayout(layout) bottomLayout = QHBoxLayout() bottomLayout.addWidget(bottomLeftLayout) bottomLayout.addWidget(bottomRightLayout) mainLayout = QGridLayout() mainLayout.addLayout(topLayout, 0, 0, 1, 2) mainLayout.addLayout(bottomLayout, 1, 0, 1, 2) mainLayout.addWidget(self.bottomLeftTabWidget, 1, 0) mainLayout.addWidget(self.bottomRightTabWidget, 1, 1) mainLayout.addWidget(self.progressBar, 3, 0, 1, 2) mainLayout.setRowStretch(0, 1) mainLayout.setRowStretch(1, 1) mainLayout.setRowMinimumHeight(1, 200) mainLayout.setColumnStretch(0, 1) mainLayout.setColumnStretch(1, 1) self.setLayout(mainLayout) self.setWindowTitle("Pituitary Cytokeratin Spatial Frequency") QApplication.setStyle(QStyleFactory.create('Fusion')) QApplication.setPalette(QApplication.style().standardPalette())
def run(): """Run the application""" # import faulthandler # faulthandler.enable() parser = argparse.ArgumentParser(prog="pyxrf", description="Command line arguments") parser.add_argument( "-l", "--loglevel", default="INFO", type=str, dest="loglevel", choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], help="Logger level. Set to 'DEBUG' in order to see debug information.", ) parser.add_argument( "-ct", "--color-theme", default="DEFAULT", type=str, dest="color_theme", choices=["DEFAULT", "DARK"], help="Color theme: DARK theme is only for debugging purposes.", ) args = parser.parse_args() # Setup the Logger logger.setLevel(args.loglevel) formatter = logging.Formatter( fmt="%(asctime)s : %(levelname)s : %(message)s") stream_handler = logging.StreamHandler() stream_handler.setFormatter(formatter) stream_handler.setLevel(args.loglevel) logger.addHandler(stream_handler) # Suppress warnings except if the program is run in debug mode if args.loglevel != "DEBUG": sys.tracebacklimit = 0 gpc = GlobalProcessingClasses() gpc.initialize() app = QApplication(sys.argv) # The default font looks bad on Windows, so one of the following (commonly available) # fonts will be selected in the listed order windows_font_selection = ["Verdana", "Microsoft Sans Serif", "Segoe UI"] available_font_families = list(QFontDatabase().families()) selected_font_family = None current_os = platform.system() if current_os == "Linux": style = "Fusion" elif current_os == "Windows": style = "Fusion" # Select font for font_family in windows_font_selection: if font_family in available_font_families: selected_font_family = font_family break elif current_os == "Darwin": style = "Fusion" available_styles = list(QStyleFactory().keys()) if style not in available_styles: logger.info(f"Current OS: {current_os}") logger.info( f"Style '{style}' is not in the list of available styles {available_styles}." ) app.setStyle(style) app.setApplicationName("PyXRF") # app.setStyleSheet('QWidget {font: "Roboto Mono"; font-size: 14px}') # app.setStyleSheet('QWidget {font-size: 14px}') if args.color_theme == "DARK": # Custom palette for Dark Mode palette = QPalette() palette.setColor(QPalette.Window, QColor(53, 53, 53)) palette.setColor(QPalette.WindowText, Qt.white) palette.setColor(QPalette.Base, QColor(25, 25, 25)) palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) palette.setColor(QPalette.ToolTipBase, Qt.white) palette.setColor(QPalette.ToolTipText, Qt.white) palette.setColor(QPalette.Text, Qt.white) palette.setColor(QPalette.Button, QColor(53, 53, 53)) palette.setColor(QPalette.ButtonText, Qt.white) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Link, QColor(42, 130, 218)) palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) palette.setColor(QPalette.HighlightedText, Qt.black) app.setPalette(palette) # Set font font = app.font() font.setPixelSize(14) if selected_font_family: logger.info( f"Replacing the default font with '{selected_font_family}'") font.setFamily(selected_font_family) app.setFont(font) # The style sheet replicates the default behavior of QToolTip on Ubuntu. # It may be helpful if some strange color theme is used. app.setStyleSheet("QToolTip {color: #000000; background-color: #FFFFCC; " "border-style: solid; border-radius: 3px; " "border-color: #444444; border-width: 1px;}") main_window = MainWindow(gpc=gpc) main_window.show() sys.exit(app.exec_())
print('hello') if __name__ == "__main__": app = QApplication(sys.argv) app.setStyle("Fusion") dark_palette = QPalette() dark_palette.setColor(QPalette.Window, QColor(51, 54, 63)) dark_palette.setColor(QPalette.WindowText, QColor(250, 250, 250)) dark_palette.setColor(QPalette.Base, QColor(39, 42, 49)) dark_palette.setColor(QPalette.AlternateBase, QColor(51, 54, 63)) dark_palette.setColor(QPalette.ToolTipBase, QColor(250, 250, 250)) dark_palette.setColor(QPalette.ToolTipText, QColor(250, 250, 250)) dark_palette.setColor(QPalette.Text, QColor(250, 250, 250)) dark_palette.setColor(QPalette.Button, QColor(51, 54, 63)) dark_palette.setColor(QPalette.ButtonText, QColor(250, 250, 250)) dark_palette.setColor(QPalette.BrightText, QColor(255, 0, 0)) dark_palette.setColor(QPalette.Link, QColor(42, 130, 218)) dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) dark_palette.setColor(QPalette.HighlightedText, QColor(0, 0, 0)) app.setPalette(dark_palette) plot_background_color = (51 / 255, 54 / 255, 63 / 255) plot_face_color = (39 / 255, 42 / 255, 49 / 255) win = MainWindow() mw = qtmodern.windows.ModernWindow(win) mw.show() sys.exit(app.exec_())
main_window.window.input_progress.setValue( main_window.window.input_progress.maximum()) main_window.window.open_video_box() app = QApplication(sys.argv) app.setStyle("Fusion") def createPalette(): palette = QPalette() palette.setColor(QPalette.Window, QColor(53, 53, 53)) palette.setColor(QPalette.WindowText, Qt.white) palette.setColor(QPalette.Base, QColor(25, 25, 25)) palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) palette.setColor(QPalette.ToolTipBase, Qt.white) palette.setColor(QPalette.ToolTipText, Qt.white) palette.setColor(QPalette.Text, Qt.white) palette.setColor(QPalette.Button, QColor(53, 53, 53)) palette.setColor(QPalette.ButtonText, Qt.white) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Link, QColor(42, 130, 218)) palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) palette.setColor(QPalette.HighlightedText, Qt.black) return palette app.setPalette(createPalette()) main_window = MainWindow() sys.exit(app.exec_())
# Now use a palette to switch to dark colors: palette = QPalette() palette.setColor(QPalette.Window, QColor(53, 53, 53)) palette.setColor(QPalette.WindowText, Qt.white) palette.setColor(QPalette.Base, QColor(25, 25, 25)) palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) palette.setColor(QPalette.ToolTipBase, Qt.white) palette.setColor(QPalette.ToolTipText, Qt.white) palette.setColor(QPalette.Text, Qt.white) palette.setColor(QPalette.Button, QColor(53, 53, 53)) palette.setColor(QPalette.ButtonText, Qt.white) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Link, QColor(42, 130, 218)) palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) palette.setColor(QPalette.HighlightedText, Qt.black) appStyle.setPalette(palette) # Second Window class Grade_Level(QDialog): def __init__(self): super(Grade_Level, self).__init__() self.setWindowIcon(QIcon('logo/sacred_logo.png')) self.setWindowTitle('Name of School or Company Name') self.ui() def ui(self): font = QtGui.QFont() font.setPointSize(12) layout = QGridLayout()
self.FPGActrlGroupBox() self.Visualization() self.MessageGroupBox() self.ViewControl() self.ChannelGroupBox() mainLayout = QGridLayout() mainLayout.addWidget(self.MsggroupBox,0,0,4,1) #mainLayout.addWidget(self.sCheckgroupBox,0,1) mainLayout.addWidget(self.ADCgroupBox,0,1) mainLayout.addWidget(self.FPGAgroupBox,1,1) mainLayout.addWidget(self.ViewControlgroupBox,2,1) mainLayout.addWidget(self.ChngroupBox,3,1) mainLayout.addWidget(self.Canvas,0,2,4,1) #Set Layout self.setLayout(mainLayout) self.Change_mode('Normal') ## Start Qt event loop unless running in interactive mode or using pyside. if __name__ == '__main__': import sys app = QApplication([]) app.setStyle("windows") #Change it to Windows Style app.setPalette(QApplication.style().standardPalette()) window = MainWindow() window.show() sys.exit(app.exec_()) #Run the main Qt loop #QtGui.QApplication.instance().exec_()
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)) palette.setColor(QPalette.ToolTipText, QColor("#EBEBEB")) app.setPalette(palette) app.setStyleSheet("QMenu::item:selected { padding: 2px 25px 2px 20px; color: #ffffff; background-color: #FFA02F; }" "\nQMenu::item{ padding: 2px 25px 2px 20px; border: 1px solid transparent; }" #"\nQMdiSubWindow { border: 1px solid #000000; border-radius:1px; background: #404040 ; }" ) # Launch application sys._excepthook = sys.excepthook #Launch app and intercept exceptions occuring in qt slots def exception_hook(exctype, value, traceback): sys._excepthook(exctype, value, traceback) time.sleep(10) sys.exit(1) sys.excepthook = exception_hook win = RetinaApp() #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
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(sys.argv) 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 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
class FomodInstallerGui(QtWidgets.QMainWindow): def __init__(self, fomod_root): self.root = Path(fomod_root) self.installer = pyfomod.Installer(self.root) self.app = QApplication([]) self.app.setStyle('Fusion') dark_palette = QPalette() dark_palette.setColor(QPalette.Window, QColor(53, 53, 53)) dark_palette.setColor(QPalette.WindowText, Qt.white) dark_palette.setColor(QPalette.Base, QColor(25, 25, 25)) dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ToolTipBase, Qt.white) dark_palette.setColor(QPalette.ToolTipText, Qt.white) dark_palette.setColor(QPalette.Text, Qt.white) dark_palette.setColor(QPalette.Button, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ButtonText, Qt.white) dark_palette.setColor(QPalette.BrightText, Qt.red) dark_palette.setColor(QPalette.Link, QColor(42, 130, 218)) dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) dark_palette.setColor(QPalette.HighlightedText, Qt.black) self.app.setPalette(dark_palette) self.app.setStyleSheet(''' QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; } ''') super().__init__() uic.loadUi(UI_FILE, self) # load the gui self.show() self.ensure_gui_elements() self.apply_initial_sizes() self.setup_signal_handlers() self.initial_render() def ensure_gui_elements(self): expected = [ 'DataTabs', 'SelectedFilesTab', 'SelectedFilesText', 'ChoicesTab', 'ChoicesText', 'FomodWizardGroup', 'FomodNameLabel', 'FomodMetaLabel', 'FomodPhotoLabel', 'FomodPhotoVSplitter', 'FomodInstructions', 'FomodOptionsGroup', 'FomodBackButton', 'FomodNextButton' ] for element in expected: assert hasattr(self, element), f'cannot access element {element}' def apply_initial_sizes(self): # width = QtWidgets.qApp.desktop().availableGeometry(self).width() height = QtWidgets.qApp.desktop().availableGeometry(self).height() self.FomodPhotoVSplitter.setSizes([height / 2, height / 2]) def setup_signal_handlers(self): self.FomodNextButton.clicked.connect(self.next_page) self.FomodBackButton.clicked.connect(self.previous_page) def initial_render(self): self.FomodNameLabel.setText(self.installer.root.name) self.FomodMetaLabel.setText(f'Author: {self.installer.root.author}\n' f'Version: {self.installer.root.version}\n' f'Website: {self.installer.root.website}') self.next_page() def previous_page(self): previous_data = self.installer.previous() if previous_data: page, selected = previous_data self.render_page(page, selected=selected) self.render_files() self.render_choices() def next_page(self): selected = [] if self.FomodOptionsGroup.data(): selected = [ option_item.data() for option_item in self.FomodOptionsGroup.data() if option_item.isChecked() ] page = self.installer.next(selected) if page: self.render_page(page) else: print('done!') self.render_files() self.render_choices() def render_page(self, page, selected=None): selected = selected or [] old_layout = self.FomodOptionsGroup.layout() if old_layout: QWidget().setLayout(old_layout) self.FomodOptionsGroup.setTitle(page.name) self.FomodOptionsGroup.setData([]) groups_layout = QVBoxLayout() for i, group in enumerate(page): groupbox = FomodOptionsGroup(self.FomodOptionsGroup) groupbox.setGroup(group) if i == 0 and groupbox.firstOptionItem(): self.render_option_hover(groupbox.firstOptionItem()) groupbox.selectFrom(selected) groupbox.mouseEnteredOption.connect(self.render_option_hover) groups_layout.addWidget(groupbox) self.FomodOptionsGroup.data().extend(groupbox.optionItems()) v_spacer = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) groups_layout.addItem(v_spacer) self.FomodOptionsGroup.setLayout(groups_layout) def render_files(self): lines = [] lines.append('flags:') for key, value in self.installer.flags().items(): lines.append(f'{repr(key)}: {repr(value)}') lines.append('') lines.append('files:') for src, dest in self.installer.files().items(): lines.append(f'{src}') lines.append(f' -> {dest}') self.SelectedFilesText.setText(os.linesep.join(lines)) scroll_bar = self.SelectedFilesText.verticalScrollBar() scroll_bar.setValue(scroll_bar.maximum()) def render_choices(self): choices = {} for page, selected_options in self.installer._previous_pages.items(): for group in page: for option in group: for selected in selected_options: if option is selected: (choices.setdefault('fomod', {}).setdefault( 'inputs', {}).setdefault(page.name, {}).setdefault( group.name, []).append(option.name)) break self.ChoicesText.setText(yaml_dump(choices)) def render_option_hover(self, option_item): option = option_item.data() if option.image: self.FomodPhotoLabel.setPhoto(str(self.root / option.image)) self.FomodPhotoLabel.setText('') self.FomodInstructions.setText(option.description) def run(self): print('Running App') self.app.exec_()
def main(): app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Cleanlooks")) app.setPalette(QApplication.style().standardPalette()) parentWindow = Iwindow(None) sys.exit(app.exec_())
def main(): app_name = "IntelPy" #os.path.dirname(__file__) script_dir = os.getcwd() resources_dir = os.path.join(script_dir, "intelpy", "resources") # Set the default configuration default_json = { "home_system": "1DQ1-A", "eve_log_location": "", "watched_channels": [ "delve.imperium", "querious.imperium", "ftn.imperium", "vnl.imperium", "cr.imperium", "aridia.imperium", "khanid.imperium", "lone.imperium" ], "alert_jumps": 3, "alert_systems": [], "log_watch_active": 1, "config_loc": "", "alarm_sound": str(resources_dir) + os.sep + "alarm2.mp3", "display_alerts": 1, "display_clear": 1, "display_all": 1, "filter_status": 1, "filter_clear": 1, "debug": 0, "message_timeout": 1.0, "alert_timeout": 5, "dark_theme": 0 } configuration = config.Config(app_name, default_json) configuration.value["config_loc"] = configuration.file_location # todo: remove this for release (set to 0) configuration.value["debug"] = 1 if configuration.value["debug"]: logger = intelpy.logging.logger.logger(app_name) logger.write_log("== New instance of IntelPy Started ==") print("---- IntelPy ----") print("Debug enabled. See debug.log for output.") logger.write_log("Loading Eve data..") else: logger = None # Load eve data eve_data_file = str(resources_dir) + os.sep + "evedata.p" eve_systems = str(resources_dir) + os.sep + "systems.p" eve_idstosystems = str(resources_dir) + os.sep + "idtosystems.p" eve_data = evedata.EveData(eve_data_file, eve_systems, eve_idstosystems) if configuration.value["debug"]: logger.write_log("---- Configuration on loading ----") logger.write_log("eve_data_file: " + eve_data_file) logger.write_log("eve_systems: " + eve_systems) logger.write_log("eve_ids to systems: " + eve_idstosystems) #debug_config.debug_config(configuration) logger.debug_config(configuration) # Load main window GUI app = QApplication(sys.argv) # Nice dark theme if the user wishes to use it if 'dark_theme' not in configuration.value: configuration.value['dark_theme'] = 0 configuration.flush_config_to_file() if configuration.value['dark_theme'] == 1: logger.write_log("Dark theme was enabled") app.setStyle("Fusion") palette = QPalette() palette.setColor(QPalette.Window, QColor(53, 53, 53)) palette.setColor(QPalette.WindowText, Qt.white) palette.setColor(QPalette.Base, QColor(25, 25, 25)) palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) palette.setColor(QPalette.ToolTipBase, Qt.white) palette.setColor(QPalette.ToolTipText, Qt.white) palette.setColor(QPalette.Text, Qt.white) palette.setColor(QPalette.Button, QColor(53, 53, 53)) palette.setColor(QPalette.ButtonText, Qt.white) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Link, QColor(42, 130, 218)) palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) palette.setColor(QPalette.HighlightedText, Qt.black) app.setPalette(palette) window = mainwindow_intelpy.MainWindow(configuration, eve_data, logger) window.show() app.exec_() if configuration.value["debug"]: logger.write_log("---- Configuration after closing ----") #debug_config.debug_config(configuration) logger.debug_config(configuration) logger.write_log("== This instance of IntelPy closed ==") # Flush configuration # todo: remove this for release (set to 0) configuration.value["debug"] = 0 configuration.flush_config_to_file() window.stop_watchdog()
def changeStyle(self, styleName): QApplication.setStyle(QStyleFactory.create(styleName)) QApplication.setPalette(QApplication.style().standardPalette())
def changePalette(self): #if (self.useStylePaletteCheckBox.isChecked()): QApplication.setPalette(QApplication.style().standardPalette())
App.setStyle('Fusion') palette = QPalette() palette.setColor(QPalette.Window, QColor(53, 53, 53)) palette.setColor(QPalette.WindowText, Qt.white) palette.setColor(QPalette.Base, QColor(25, 25, 25)) palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) palette.setColor(QPalette.ToolTipBase, Qt.white) palette.setColor(QPalette.ToolTipText, Qt.white) palette.setColor(QPalette.Text, Qt.white) palette.setColor(QPalette.Button, QColor(53, 53, 53)) palette.setColor(QPalette.ButtonText, Qt.white) palette.setColor(QPalette.BrightText, Qt.red) palette.setColor(QPalette.Link, QColor(42, 130, 218)) palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) palette.setColor(QPalette.HighlightedText, Qt.black) App.setPalette(palette) _EventNames = ["პური", "იოგურტი", "ლობიო", "შაქარი", "კარტოფილი"] outcomeTable_header = ['მოვლენა','რაოდენობა','კატეგორია','ფასი','გადახდის ტიპი'] incomeTable_header = ['წყარო','რაოდენობა'] incomeSourceCategory = ['ავანსი','ხელფასი','პრემია','მივლინება','ქეშბექი','საჩუქარი','პრიზი','კონვერტაცია','სხვა','ვალი მიღება','სესხი'] outComeCategory = [ 'კვება','სხვადასხვა','ქირა','საყოფაცხოვრებო','კომუნალური','ტელეფონი', 'ინტერნეტი','გართობა','ტანსაცმელი','ჰიგიენა','მედიკამენტები','ინტერნეტი', 'ტრანსპორტი','მოწყობილობები','დასვენება','საჩუქარი','გამოწერა','საკომისიო','აღჭურვილობა', 'ვარჯიში','რემონტი','ექიმთან კონსულტაცია','მკურნალობა','ჯარიმა','მოგზაურობა','გასესხება','ვალის გადახდა'] units = ['--','ც','კგ','გრ','ლ','მლ','კვტ','თვე','დღე'] Currency = {'₽' : 'icon/Ruble.png', '$' : 'icon/Dollar.png', '€' : 'icon/Euro.png', 'CHF': 'icon/swiss-franc.png', '₾' : 'icon/Lari.png',
QCoreApplication.setApplicationVersion("0.0.1") QCoreApplication.setOrganizationName("CrowdWare") app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Fusion")) app.setStyleSheet("QPushButton:hover { color: #45bbe6 }") #qmlRegisterType(Column, 'Maria', 2, 0, 'Column') p = app.palette() p.setColor(QPalette.Window, QColor(53, 53, 53)) p.setColor(QPalette.WindowText, Qt.white) p.setColor(QPalette.Base, QColor(64, 66, 68)) p.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) p.setColor(QPalette.ToolTipBase, Qt.white) p.setColor(QPalette.ToolTipText, Qt.black) p.setColor(QPalette.Text, Qt.white) p.setColor(QPalette.Button, QColor(53, 53, 53)) p.setColor(QPalette.ButtonText, Qt.white) p.setColor(QPalette.BrightText, Qt.red) p.setColor(QPalette.Highlight, QColor("#45bbe6")) p.setColor(QPalette.HighlightedText, Qt.black) p.setColor(QPalette.Disabled, QPalette.Text, Qt.darkGray) p.setColor(QPalette.Disabled, QPalette.ButtonText, Qt.darkGray) p.setColor(QPalette.Link, QColor("#bbb")) app.setPalette(p) app.setWindowIcon(QIcon(":/images/logo.svg")) win = MainWindow(app) win.show() sys.exit(app.exec_())
# create label label1 = QLabel('Hello World') label2 = QLabel('by ToraNova') exit_button = QPushButton('Exit') exit_button.clicked.connect(exit_gui_prog) # create a widget window = QWidget() # layout define layout = QVBoxLayout() # populate layout layout.addWidget(label1) layout.addWidget(label2) layout.addWidget(exit_button) # set layout window.setLayout(layout) window.setWindowTitle('PYQT') # display window # window.show() window.showFullScreen() app.setPalette(dark_palette) #dark theme, comment to disable app.setStyle('Fusion') app.setStyleSheet( "QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }" ) # hand over control app.exec_()
dark_palette.setColor(QPalette.Window, QColor(53, 53, 53)) dark_palette.setColor(QPalette.WindowText, Qt.white) dark_palette.setColor(QPalette.Base, QColor(25, 25, 25)) dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ToolTipBase, Qt.white) dark_palette.setColor(QPalette.ToolTipText, Qt.white) dark_palette.setColor(QPalette.Text, Qt.white) dark_palette.setColor(QPalette.Button, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ButtonText, Qt.white) dark_palette.setColor(QPalette.BrightText, Qt.red) dark_palette.setColor(QPalette.Link, QColor(42, 130, 218)) dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) dark_palette.setColor(QPalette.HighlightedText, Qt.black) qApp.setPalette(dark_palette) qApp.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }") window = QWidget() buttonTop = QPushButton('Top') buttonBottom = QPushButton('Bottom') buttonTop.clicked.connect(on_button_clicked) buttonBottom.clicked.connect(on_button_clicked) layout = QVBoxLayout() layout.addWidget(buttonTop) layout.addWidget(buttonBottom) window.setLayout(layout) window.show() qApp.exec_()
self.player.pause() else: # Меняем картинку на 2 палочки (пауза) self.is_playing = True self.playBtn.setStyleSheet('background-image: url(icons/pause.png)') # Запускаем звук self.player.play() def change_volume(self): """Мини-Функция для передачи уровня громкости в плеер""" # Функцию использует несколько объектов сразу, проверяем вызывателя if self.sender() == self.volumeBtn: # Если функцию вызвала кнопка, то включаем/выключаем отображение слайдера if not self.volumeSlider.isHidden(): self.volumeSlider.hide() else: self.volumeSlider.show() else: # Иначе функцию вызвал сам слайдер. Значит, меняем значение self.player.setVolume(self.volumeSlider.value()) self.equalizer.setValue(self.volumeSlider.value()) if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle('Fusion') ex = MyWidget() app.setPalette(ex.palette()) ex.show() sys.exit(app.exec_())
defaultFont.setPointSize(defaultFont.pointSize()+2); app.setFont(defaultFont); darkPalette = QPalette(); darkPalette.setColor(QPalette.Window,QColor(53,53,53)); darkPalette.setColor(QPalette.WindowText,Qt.white); darkPalette.setColor(QPalette.Disabled,QPalette.WindowText,QColor(127,127,127)); darkPalette.setColor(QPalette.Base,QColor(42,42,42)); darkPalette.setColor(QPalette.AlternateBase,QColor(66,66,66)); darkPalette.setColor(QPalette.ToolTipBase,Qt.white); darkPalette.setColor(QPalette.ToolTipText,Qt.white); darkPalette.setColor(QPalette.Text,Qt.white); darkPalette.setColor(QPalette.Disabled,QPalette.Text,QColor(127,127,127)); darkPalette.setColor(QPalette.Dark,QColor(35,35,35)); darkPalette.setColor(QPalette.Shadow,QColor(20,20,20)); darkPalette.setColor(QPalette.Button,QColor(53,53,53)); darkPalette.setColor(QPalette.ButtonText,Qt.white); darkPalette.setColor(QPalette.Disabled,QPalette.ButtonText,QColor(127,127,127)); 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.Disabled,QPalette.Highlight,QColor(80,80,80)); darkPalette.setColor(QPalette.HighlightedText,Qt.white); darkPalette.setColor(QPalette.Disabled,QPalette.HighlightedText,QColor(127,127,127)); app.setPalette(darkPalette); w = ReaderServer() w.show() w.run() sys.exit(app.exec_())
GL.glBegin(GL.GL_TRIANGLES) GL.glVertex2f(0, tri_size) GL.glColor3f(1, 0, 0) GL.glVertex2f(-tri_size, -tri_size) GL.glColor3f(0, 1, 0) GL.glVertex2f(tri_size, -tri_size) GL.glColor3f(0, 0, 1) GL.glEnd() GL.glFlush() self.swapBuffers() if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle('Fusion') app.setPalette(get_dark_palette()) opengl_window = WindowGL() opengl_window.resize(500, 500) opengl_window.setPosition(25, 225) opengl_window.show() cal_window = WindowCal() cal_window.move(625, 125) cal_window.show() ui_window = WindowUI() ui_window.resize(350, 150) ui_window.move(1425, 225) ui_window.show()
if __name__ == '__main__': try: QCoreApplication.setLibraryPaths(['C:\\Users\\lidingke\\Envs\\py34qt5\\Lib\\site-packages\\PyQt5\\plugins']) except Exception as e: pass app = QApplication(sys.argv) pt = QPalette() pt.setColor(QPalette.Background , QColor(239,246,250)) # pt.setColor(QPalette.Button, QColor(239,246,250)) pt.setColor(QPalette.ButtonText, QColor(34,39,42)) # pt.setColor(QPalette.WindowText, QColor(34,39,42)) pt.setColor(QPalette.Highlight, QColor(74,149,184)) app.setPalette(pt) font = app.font() font.setPointSize(10) font.setFamily('微软雅黑') app.setFont(font) gui = View() presenter = Presenter(gui) gui.show() sys.exit(app.exec_())
def changePalette(self): if (self.useStylePaletteCheckBox.isChecked()): QApplication.setPalette(QApplication.style().standardPalette()) else: QApplication.setPalette(self.originalPalette)
def change_palette(self): QApplication.setPalette(QApplication.style().standardPalette())
if self.playpause.text() == "Play": self.playpause.setText("Pause") spotify.start_playback() #self.thread.start() else: self.playpause.setText("Play") spotify.pause_playback() #self.worker.disconnect() #self.thread.terminate() if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle("Fusion") palette = QPalette() palette.setColor(QPalette.Window, QColor(30, 30, 30)) palette.setColor(QPalette.WindowText, QColor(255, 255, 255)) palette.setColor(QPalette.Base, QColor(53, 53, 53)) palette.setColor(QPalette.AlternateBase, QColor(30, 30, 30)) palette.setColor(QPalette.ToolTipBase, QColor(0, 0, 0)) palette.setColor(QPalette.ToolTipText, QColor(255, 255, 255)) palette.setColor(QPalette.Text, QColor(255, 255, 255)) palette.setColor(QPalette.Button, QColor(53, 53, 53)) palette.setColor(QPalette.ButtonText, QColor(255, 255, 255)) palette.setColor(QPalette.BrightText, QColor(255, 255, 255)) palette.setColor(QPalette.Link, QColor(42, 130, 218)) palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) palette.setColor(QPalette.HighlightedText, QColor(0, 0, 0)) app.setPalette(palette) ex = App() sys.exit(app.exec_())
def view_volume(vol=None, args=None, window_name=None): global PARAM_WIDTH, SCROLL_WIDTH, UI_EXTRA_SCALING, CLIPBOARD, app if window_name is None: window_name = APP_NAME if args is None: args = sys.argv QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) app = QApplication(args) if LOGICAL_DPI_BASELINE is not None: # This is used to fix fractional scaling in Windows, which does # not show up as a devicePixelRatio! UI_EXTRA_SCALING = QWidget().logicalDpiX() / LOGICAL_DPI_BASELINE PARAM_WIDTH = int(PARAM_WIDTH * UI_EXTRA_SCALING) SCROLL_WIDTH = int(SCROLL_WIDTH * UI_EXTRA_SCALING) app.setStyle('Fusion') app.setPalette(generateDarkPalette()) app.setStyleSheet(f''' QWidget {{ font-size: {int(12 * UI_EXTRA_SCALING)}px; }} QLabel, QSlider, QSpinBox, QDoubleSpinBox, QCheckBox {{ padding: 0px; margin: 0px; }} QGroupBox {{ padding: 0px; padding-top: 20px; margin: 0px; }} QScrollBar:vertical {{ width: {SCROLL_WIDTH}px; }} #Border {{ border: 1px solid #808080; border-radius: 4px; margin-top: 0px; margin-bottom: 5px; }} QTabBar::tab:selected {{ color: palette(Text); }} QTabBar::tab:!selected {{ color: #A0A0A0; }} ''') app.setApplicationDisplayName(window_name) window = VolumetricViewer(clipboard=app.clipboard(), window_name=window_name) if vol is not None: window.openData(vol) app.setWindowIcon( QtGui.QIcon(QtGui.QPixmap(os.path.join(ICON_DIR, 'muvi_logo.png')))) return (app.exec())
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): # The generate UI script cannot be found so we are most likely in release mode, no problem here. pass from urh.util import util util.set_shared_library_path() try: import urh.cythonext.signal_functions 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.path.realpath(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() font_size = constants.SETTINGS.value("font_size", 0, int) if font_size > 0: font = app.font() font.setPointSize(font_size) app.setFont(font) 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() # allow usage of prange (OpenMP) in Processes multiprocessing.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") 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