def __init__(self): super().__init__(sys.argv) self.setOrganizationName('Pynocchio') self.setApplicationName('Pynocchio') self.setStyle('Fusion') self.setStyleSheet(qdarkgraystyle.load_stylesheet()) if hasattr(self, 'setApplicationDisplayName'): self.setApplicationDisplayName('Pynocchio') for path in DATADIRS: self.addLibraryPath(path) translator = QTranslator(self) language = QLocale.system().uiLanguages()[0] + '.qm' for path in DATADIRS: if translator.load(language, os.path.join(path, 'locale')): break qt_translator = QTranslator(self) qt_translator.load( 'qt_' + QLocale.system().name(), QLibraryInfo.location(QLibraryInfo.TranslationsPath)) self.installTranslator(translator) self.installTranslator(qt_translator) self.model = MainWindowModel() self.view = MainWindowView(self.model)
def __init__(self): super().__init__(sys.argv) self.setOrganizationName('Pynocchio') self.setApplicationName('Pynocchio') self.setStyle('Fusion') self.setStyleSheet(qdarkgraystyle.load_stylesheet()) if hasattr(self, 'setApplicationDisplayName'): self.setApplicationDisplayName('Pynocchio') for path in DATADIRS: self.addLibraryPath(path) translator = QTranslator(self) language = QLocale.system().uiLanguages()[0] + '.qm' for path in DATADIRS: if translator.load(language, os.path.join(path, 'locale')): break qt_translator = QTranslator(self) qt_translator.load('qt_' + QLocale.system().name(), QLibraryInfo.location( QLibraryInfo.TranslationsPath)) self.installTranslator(translator) self.installTranslator(qt_translator) self.model = MainWindowModel() self.view = MainWindowView(self.model)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1000, 700) MainWindow.setStyleSheet( qdarkgraystyle.load_stylesheet() + 'QPlainTextEdit {selection-background-color: white}') icon = QIcon() icon.addFile('../Images/python.png', QSize(256, 256)) MainWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_2.setObjectName("gridLayout_2") self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) self.tabWidget.setObjectName("tabWidget") self.tab = GeneralWidget() self.tabWidget.addTab(self.tab, "") self.gridLayout_2.addWidget(self.tabWidget, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionnewAction = QtWidgets.QAction(MainWindow) self.actionnewAction.setObjectName("actionnewAction") self.tabWidget.setTabsClosable(True) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) self.tabWidget.tabBarDoubleClicked['int'].connect(self.addTab) self.tabWidget.tabCloseRequested['int'].connect(self.tab_close) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def main(): """ Application entry point """ logging.basicConfig(level=logging.DEBUG) # create the application and the main window app = QtWidgets.QApplication(sys.argv) window = QtWidgets.QMainWindow() # setup ui ui = example_ui.Ui_MainWindow() ui.setupUi(window) ui.bt_delay_popup.addActions([ui.actionAction, ui.actionAction_C]) ui.bt_instant_popup.addActions([ui.actionAction, ui.actionAction_C]) ui.bt_menu_button_popup.addActions([ui.actionAction, ui.actionAction_C]) window.setWindowTitle('QDarkGrayStyle example') # tabify dock widgets to show bug #6 window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2) # setup stylesheet app.setStyleSheet(qdarkgraystyle.load_stylesheet()) # auto quit after 2s when testing on travis-ci if '--travis' in sys.argv: QtCore.QTimer.singleShot(2000, app.exit) # run window.show() app.exec_()
def main(): os.chdir(os.path.dirname( os.path.abspath(__file__))) # to load the directory folder app = QtWidgets.QApplication(sys.argv) application = ApplicationWindow() app.setStyleSheet(qdarkgraystyle.load_stylesheet()) application.show() app.exec_()
def on_action_dark_style_triggered(self): qApp = QtWidgets.QApplication.instance() if self.ui.action_dark_style.isChecked(): try: qApp.setStyleSheet(qdarkgraystyle.load_stylesheet()) except NameError: pass else: qApp.setStyleSheet(self.default_stylesheet)
def change_theme(self, theme_name: str): if theme_name == "default": self.app.setStyleSheet("") elif theme_name == "dark-gray": self.app.setStyleSheet(qdarkgraystyle.load_stylesheet()) elif theme_name == "dark": self.app.setStyleSheet( qdarkstyle.load_stylesheet_from_environment()) self.conf.store("theme", theme_name)
def main(): app = QCoreApplication.instance() if app is None: app = QApplication(sys.argv) app.setStyleSheet(qdarkgraystyle.load_stylesheet()) main = MainScreen() main.show() app.exec_()
def BarTepki(self,action): # BarTepki Adında Bir Fonksiyon Oluşturduk #---------------------------------------------------------------------------------------------------------# ### Dosya İşlemleri if action.text() == "Dosya Aç": dosya_ismi = QFileDialog.getOpenFileName(self, "Dosya Aç", filter="Tüm Dosyalar (*);;Python (*.py)") with open(dosya_ismi[0], "r", encoding='utf-8-sig') as gelen_dosya: self.alinanKurslar.setText(gelen_dosya.read()) if action.text() == "Dosya Kaydet": dosya_ismi = QFileDialog.getSaveFileName(self, "Dosya Kaydet", filter="Çıkışlar TxT (*.txt)") with open(dosya_ismi[0], "w", encoding='utf-8-sig') as gelen_dosya: gelen_dosya.write(self.alinanKurslar.toPlainText()) if action.text() == "Temizle": self.alinanKurslar.clear() if action.text() == "Çıkış": qApp.quit() #---------------------------------------------------------------------------------------------------------# #--------------------------------------# ### Temalar if action.text() == "Mavimsi Tema": self.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5')) if action.text() == "Kara Tema": self.setStyleSheet(qdarkgraystyle.load_stylesheet()) #--------------------------------------# #----------------------------------------------------------------------------------------------------------------# ### Hakkında if action.text() == "Hakkında": self.hakkinda_pencere = QWidget() # Penceremizi Oluşturduk self.hakkinda_pencere.show() # Penceremizi Açtık self.hakkinda_pencere.setWindowTitle(f"{action.text()} / {pencere_basligi}")# Pencere Başlığımızı Belirledik self.hakkinda_pencere.setWindowIcon(QIcon("img/udemy.png")) # Pencere İkonumuzu Belirledik self.hakkinda_pencere.setStyleSheet(open("style/style.qss", "r").read()) # Stil Dosyamızı Çağırdık self.vBox = QVBoxLayout() # Logo self.logo = QLabel() self.logo.setPixmap(QPixmap(r"img/KekikAkademiQt5Logo.png")) self.logo.setAlignment(Qt.AlignCenter) # Açıklama self.aciklama = QLabel() self.aciklama.setText("""@keyiflerolsun tarafından Eğitim Amaçlı Yazılmıştır. Telegram Kanalımıza Bekleriz: @KekikAkademi""") self.aciklama.setFont(QFont("Courier", 16, QFont.Bold)) self.aciklama.setAlignment(Qt.AlignTop | Qt.AlignCenter) self.vBox.addWidget(self.aciklama) self.vBox.addWidget(self.logo) self.hakkinda_pencere.setLayout(self.vBox)
def setStyleSheet(app, myapp): if os.name == 'posix': type = 'QDarkStyle' else: type = 'QtModern' if type == 'QtModern': try: import qtmodern.styles import qtmodern.windows packagedir = os.path.dirname(os.path.realpath(__file__)) with open(packagedir + "/RTOC_GUI/ui/qtmodern.qss", 'r') as myfile: stylesheet = myfile.read().replace('\n', '') app.setStyleSheet(stylesheet) qtmodern.styles.dark(app) # mw = qtmodern.windows.ModernWindow(myapp) mw = myapp return app, mw except (ImportError, SystemError): tb = traceback.format_exc() logging.debug(tb) logging.warning("QtModern not installed") type = 'QDarkStyle' if type == 'QDarkStyle': try: import qdarkstyle dark_stylesheet = qdarkstyle.load_stylesheet_pyqt5() app.setStyleSheet(dark_stylesheet) return app, myapp except (ImportError, SystemError): tb = traceback.format_exc() logging.debug(tb) logging.warning("QtModern not installed") type == 'qdarkgraystyle' if type == 'qdarkgraystyle': try: import qdarkgraystyle dark_stylesheet = qdarkgraystyle.load_stylesheet() app.setStyleSheet(dark_stylesheet) return app, myapp except (ImportError, SystemError): tb = traceback.format_exc() logging.debug(tb) logging.warning("QtModern not installed") packagedir = os.path.dirname(os.path.realpath(__file__)) with open(packagedir + "/RTOC_GUI/ui/darkmode.html", 'r') as myfile: stylesheet = myfile.read().replace('\n', '') stylesheet = stylesheet.replace( '/RTOC_GUI/ui/icons', os.path.join(packagedir, 'data', 'ui', 'icons').replace('\\', '/')) # stylesheet = stylesheet.replace('/RTOC_GUI/ui/icons','./RTOC_GUI/ui/icons') app.setStyleSheet(stylesheet) return app, myapp
def renkDegis(self): if self.renk: self.setStyleSheet(qdarkgraystyle.load_stylesheet()) self.renk = False else: self.setStyleSheet(""" QWidget { border: 2px solid black; border-radius: 10px; background-color: rgb(255, 255, 255); } """) self.renk = True
def setTheme(app): global theme if theme == "Classic Dark": qtmodern.styles.dark(app) elif theme == "Dark Blue": app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) elif theme == "Dark Orange": app.setStyleSheet(pyqtcss.get_style("dark_orange")) elif theme == "Dark Yellow": app.setStyleSheet(qdarkgraystyle.load_stylesheet()) elif theme == "Dark Black": app.setStyle("Fusion") palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor(53,53,53)) palette.setColor(QtGui.QPalette.WindowText, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(15,15,15)) palette.setColor(QtGui.QPalette.AlternateBase, QtGui.QColor(53,53,53)) palette.setColor(QtGui.QPalette.ToolTipBase, QtCore.Qt.white) palette.setColor(QtGui.QPalette.ToolTipText, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Text, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53,53,53)) palette.setColor(QtGui.QPalette.ButtonText, QtCore.Qt.white) palette.setColor(QtGui.QPalette.BrightText, QtCore.Qt.red) palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(142,45,197).lighter()) palette.setColor(QtGui.QPalette.HighlightedText, QtCore.Qt.black) app.setPalette(palette) elif theme == "Dark GrayGreen": app.setStyle("Fusion") palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor(12, 60, 12)) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(15, 15, 15)) palette.setColor(QtGui.QPalette.AlternateBase, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.ToolTipBase, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Text, QtCore.Qt.white) palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.ButtonText, QtCore.Qt.white) palette.setColor(QtGui.QPalette.BrightText, QtCore.Qt.red) palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(142, 45, 197).lighter()) palette.setColor(QtGui.QPalette.HighlightedText, QtCore.Qt.black) app.setPalette(palette) elif theme == "none": app.setStyleSheet("")
def change_color_mode(self): dark_mode_config = self._ui.dark_mode_button.isChecked() if self.app is not None: if dark_mode_config: try: import qdarkgraystyle self.app.setStyleSheet(qdarkgraystyle.load_stylesheet()) except: pass else: self.app.setStyleSheet("") QtWidgets.QMessageBox.information(self, "Information", """Your settings have correctly been applied Note that some changes will need a restart""") config.add_config({"Appearence": {"dark_mode": dark_mode_config}})
def run(): import sys from PyQt5.QtWidgets import QApplication qapp = QApplication([]) database = CrystalsDatabase() main_window = MainCrystalViewer(database) main_window.show() try: import qdarkgraystyle as style stylesheet = style.load_stylesheet() qapp.setStyleSheet(stylesheet) except ImportError: style = None sys.exit(qapp.exec_())
def main(): if len(sys.argv) > 0: path = "null" mode = "test" for i in range(len(sys.argv)): if sys.argv[i] == "-o": if i + 1 < len(sys.argv): path = sys.argv[i + 1] if sys.argv[i] == "-train": mode = "train" print(utils.bordered("Information", " Run the program with arguments: {0} \n Path: {1}, Mode: {2}".format(sys.argv, path, mode))) if mode == "train": environment = Environment() if path != "null" and os.path.isfile(path): f = open(path, 'rb') environment = pickle.load(f) print(utils.bordered("Information", " Bots: {0}, Epoch: {1}".format(len(environment.bots), environment.epoch))) f.close() else: environment.setup() print(utils.bordered("Information", " Data: {0} \n Epoch: {1}, Bots: {2}".format( datetime.datetime.today().strftime("%m-%d-%Y %H-%M-%S"), 0, len(environment.bots)))) while True: environment.update() else: app = QtWidgets.QApplication(sys.argv) app.setStyleSheet(qdarkgraystyle.load_stylesheet()) window = Apps(path) window.show() app.exec_()
def test_create_main_window(self): """ Application entry point """ logging.basicConfig(level=logging.DEBUG) # create the application and the main window app = QtWidgets.QApplication(sys.argv) window = QtWidgets.QMainWindow() # setup ui ui = example_ui.Ui_MainWindow() ui.setupUi(window) # setup stylesheet app.setStyleSheet(qdarkgraystyle.load_stylesheet()) # auto quit after 2s when testing on travis-ci QtCore.QTimer.singleShot(2000, app.exit) # run window.show() app.exec_()
def BarTepki(self, action): ### Temalar if action.text() == "Mavimsi Tema": self.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5')) if action.text() == "Kara Tema": self.setStyleSheet(qdarkgraystyle.load_stylesheet()) ### Hakkında if action.text() == "Hakkında": self.hakkinda_pencere = QWidget() self.hakkinda_pencere.show() self.hakkinda_pencere.setWindowTitle( f"{action.text()} / {self.windowTitle()}") self.hakkinda_pencere.setWindowIcon(QIcon("img/udemy.png")) self.hakkinda_pencere.setStyleSheet( open("style/style.qss", "r").read()) self.vBox = QVBoxLayout() # Logo self.logo = QLabel() self.logo.setPixmap(QPixmap(r"img/KekikAkademiQt5Logo.png")) self.logo.setAlignment(Qt.AlignCenter) # Açıklama self.aciklama = QLabel() self.aciklama.setText( """@keyiflerolsun tarafından Eğitim Amaçlı Yazılmıştır. Telegram Kanalımıza Bekleriz: @KekikAkademi""") self.aciklama.setFont(QFont("Courier", 16, QFont.Bold)) self.aciklama.setAlignment(Qt.AlignTop | Qt.AlignCenter) self.vBox.addWidget(self.aciklama) self.vBox.addWidget(self.logo) self.hakkinda_pencere.setLayout(self.vBox)
def run(self): settings = QSettings() style = settings.value(SETTINGS_STYLE, "default", type=str) if style == "dark": stylesheet = QFile(":/dark.qss") stylesheet.open(QFile.ReadOnly | QFile.Text) stream = QTextStream(stylesheet) self.app.setStyleSheet(stream.readAll()) elif style == "light": stylesheet = QFile(":/light.qss") stylesheet.open(QFile.ReadOnly | QFile.Text) stream = QTextStream(stylesheet) self.app.setStyleSheet(stream.readAll()) elif style == "dark2": self.app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5')) elif style == "darkgray": self.app.setStyleSheet(qdarkgraystyle.load_stylesheet()) else: stylesheet = self.get_resource('styles.qss') self.app.setStyleSheet(open(stylesheet).read()) self.window.show() return self.app.exec_()
def __init__(self): super().__init__() self.toplamList = [] self.miktarList = [] self.urunAdiList = [] self.fiyatList = [] ###################################################################################################################################### ####################################################################################################################### yönetici mi? # self.yetki = False if sonyetkibuken == 1: self.yetki = True if self.yetki: yoneticiad = "- YÖNETİCİ" else: yoneticiad = "- KULLANICI" ###################################################################################################################################### #################################################################################################################### uygulama düzeni # self.yenileicon = "yenile_64.png" self.kaydeticon = "save_64.png" gridtepsi = QGridLayout() self.orta = QVBoxLayout() self.soltaraf = QVBoxLayout() self.test = QHBoxLayout() sagUstKose = QHBoxLayout() self.setWindowTitle("DOĞAN DÜRÜM " + yoneticiad) self.baslik = QLabel("KAYIT ALANI") self.baslik.setFont(baslikFont) self.baslik2 = QLabel("WEB SİTE SİPARİŞ ALANI") self.baslik2.setFont(baslikFont) self.listebaslik = QLabel("SİPARİŞ LİSTESİ") self.listebaslik.setFont(baslikFont) self.web = QWebEngineView() self.web.load( QUrl("https://www.google.com")) # sitenin wordpress giriş urlsi self.grupRadyo = QGroupBox() self.radyoLay = QVBoxLayout() self.radyo1 = QRadioButton("YENİ SİPARİŞ EKLE") self.radyo2 = QRadioButton("GÖNDERİM BAŞARILI") self.radyo3 = QRadioButton("İPTAL/İADE") self.radyoLay.addWidget(self.radyo1) self.radyoLay.addWidget(self.radyo2) self.radyoLay.addWidget(self.radyo3) self.grupRadyo.setLayout(self.radyoLay) self.radyo1.toggled.connect(self.toggleRadio) self.radyo2.toggled.connect(self.toggleRadio) self.radyo3.toggled.connect(self.toggleRadio) self.otoal = QPushButton("SON SİPARİŞİN \n" ">>> OTO BİLGİSİNİ AL>>>") self.label1 = QLabel("BİGİLENDİRME : ") self.ekran = QLabel("") self.liste = QListWidget() self.detay = QLabel("EK NOT :") self.detaytext = QLineEdit("İsteğe bağlı Ek Bilgi") self.detaytext.setPlaceholderText("EK NOT EKLEYİN...") self.kaydet = QPushButton("KAYDET") self.yenile = QPushButton("YENİLE") self.yeniekle = QPushButton("MANUEL BİLGİ GİR") self.kaydet.setIcon(QtGui.QIcon(self.kaydeticon)) self.kaydet.setIconSize(QtCore.QSize(48, 48)) self.yenile.setIcon(QtGui.QIcon(self.yenileicon)) self.yenile.setIconSize(QtCore.QSize(64, 64)) self.label1.setFont(yaziFont) self.ekran.setFont(minifont) self.radyo1.setFont(yaziFont) self.radyo2.setFont(yaziFont) self.radyo3.setFont(yaziFont) self.otoal.setFont(yaziFont) self.detay.setFont(yaziFont) self.kaydet.setFont(yaziFont) self.yenile.setFont(yaziFont) self.yeniekle.setFont(yaziFont) self.yeniekle.clicked.connect(self.kontrol) self.kaydet.clicked.connect(self.kayitList) self.yenile.clicked.connect(self.f5) self.liste.itemClicked.connect(self.siparisdetay) self.otoal.clicked.connect(self.otoVeri) self.orta.addStretch() self.orta.addWidget(self.label1) self.orta.addWidget(self.ekran) self.orta.addWidget(self.otoal) self.orta.addStretch() self.orta.addWidget(self.detay) self.orta.addWidget(self.detaytext) self.orta.addStretch() self.orta.addWidget(self.grupRadyo) self.orta.addStretch() self.orta.addWidget(self.yeniekle) self.orta.addWidget(self.kaydet) self.orta.addStretch() self.grupbox = QGroupBox() self.soltaraf.addWidget(self.baslik2) self.soltaraf.addWidget(self.web) deneme = QVBoxLayout() ###################################################################################################################################### ##################################################################################################### menü kısmı başlangıc - tasarım # menubar = QMenuBar() self.girisAction = QAction( self.style().standardIcon(QStyle.SP_FileDialogBack), 'Hesaptan Çıkış Yap') self.girisAction.setShortcut('Ctrl+Q') self.girisAction.triggered.connect(self.basUyari) self.yeniSiparisAction = QAction( self.style().standardIcon(QStyle.SP_FileDialogNewFolder), 'Yeni Sipariş Ekle') self.yeniSiparisAction.setShortcut('Ctrl+Y') self.yeniSiparisAction.triggered.connect(self.veriAc) self.siparisListeAction = QAction( self.style().standardIcon(QStyle.SP_FileDialogContentsView), 'Sipariş Listesi') self.siparisListeAction.setShortcut('Ctrl+L') self.siparisListeAction.triggered.connect(self.listeAc) self.arkaAction = QAction( self.style().standardIcon(QStyle.SP_FileDialogToParent), "Renk Değiştir") if self.yetki: self.arkaAction.triggered.connect(self.renkDegis) self.renk = False else: self.arkaAction.triggered.connect(self.yetkiUyari) self.deeme = QAction( self.style().standardIcon(QStyle.SP_FileDialogInfoView), "Yardım") self.deeme.triggered.connect(self.linkAc) self.webAction = QAction( self.style().standardIcon(QStyle.SP_DialogOpenButton), "Web Sitesi") self.webAction.triggered.connect(self.siteAc) actionGiris = menubar.addMenu("Giriş") actionGiris.addAction(self.girisAction) actionSiparis = menubar.addMenu("Siparişler") actionSiparis.addAction(self.yeniSiparisAction) actionSiparis.addSeparator() actionSiparis.addAction(self.siparisListeAction) actionArkaplan = menubar.addMenu("Ayarlar") actionArkaplan.addAction(self.arkaAction) actionIletisim = menubar.addMenu("İletişim") actionIletisim.addAction(self.deeme) actionSiparis.addSeparator() actionIletisim.addAction(self.webAction) ###################################################################################################################################### ########################################################################################################### ekran düzenini yerleştir # sagUstKose.addWidget(self.listebaslik) sagUstKose.addStretch() sagUstKose.addWidget(self.yenile) gridtepsi.addWidget(menubar, 0, 0) gridtepsi.addWidget(self.baslik2, 1, 0) gridtepsi.addWidget(self.web, 2, 0) gridtepsi.addWidget(self.baslik, 1, 1) gridtepsi.addLayout(self.orta, 2, 1) gridtepsi.addLayout(sagUstKose, 1, 2) gridtepsi.addWidget(self.liste, 2, 2) deneme.addLayout(gridtepsi) self.setStyleSheet(qdarkgraystyle.load_stylesheet()) self.f5() self.setLayout(deneme) self.resize(1400, 800) self.show()
import qdarkgraystyle from fbs_runtime.application_context.PyQt5 import ApplicationContext import sys from View.Main.mainwindow import MainWindow if __name__ == "__main__": appctxt = ApplicationContext() appctxt.app.setStyleSheet(qdarkgraystyle.load_stylesheet()) window = MainWindow(app=appctxt) window.show() exit_code = appctxt.app.exec_() sys.exit(exit_code)
window_w = window.width() close_btn_x = window_w - btn_w close_btn_y = top_margin close_btn.move(close_btn_x, close_btn_y) max_btn = QPushButton(window) max_btn.setText('最大化') max_btn.resize(btn_w, btn_h) max_btn_x = close_btn_x - max_btn.width() max_btn_y = top_margin max_btn.move(max_btn_x, max_btn_y) min_btn = QPushButton(window) min_btn.setText('最小化') min_btn.resize(btn_w, btn_h) min_btn_x = max_btn_x - min_btn.width() min_btn_y = top_margin min_btn.move(min_btn_x, min_btn_y) close_btn.pressed.connect(window.close) max_btn.pressed.connect(window.showMaximized) min_btn.pressed.connect(window.showMinimized) window.setStyleSheet(qdarkgraystyle.load_stylesheet()) window.show() sys.exit(app.exec_())
rootLogger.addHandler(fileHandler) consoleHandler = StreamHandler() consoleHandler.setFormatter(formatter) rootLogger.addHandler(consoleHandler) logging.critical("") logging.critical( "------------------- Vintel %s starting up -------------------", version.VERSION) logging.critical("") logging.debug("Looking for chat logs at: %s", chatLogDirectory) logging.debug("Cache maintained here: %s", cache.Cache.PATH_TO_CACHE) logging.debug("Writing logs to: %s", vintelLogDirectory) trayIcon = systemtray.TrayIcon(self) trayIcon.show() self.mainWindow = viui.MainWindow(chatLogDirectory, trayIcon, backGroundColor) self.mainWindow.show() self.mainWindow.raise_() splash.finish(self.mainWindow) # The main application if __name__ == "__main__": app = Application(sys.argv) app.setStyleSheet(qdarkgraystyle.load_stylesheet(pyside=False)) sys.exit(app.exec_())
def create_qapp(): qapp = QApplication([]) qapp.setStyleSheet(qdarkgraystyle.load_stylesheet()) return qapp
def run(): app = QApplication(sys.argv) app.setStyleSheet(qdarkgraystyle.load_stylesheet()) GUI = Window() sys.exit(app.exec_())
while setting all the treePaths discovered into a treePaths list. :param item: is a QTreeWidgetItem object, which can have childs or not :param dirName: name of the parent directory :param treePaths: treePaths list :return: void """ # for each child of the item for i in range(0, item.childCount()): if item.child(i).text(1) == "": # is a directory: call again the function recursively into the directory getDirFilenames(item.child(i), dirName + "/" + item.child(i).text(0), treePaths) else: # is a file: append the filename to the list treePaths.append(dirName + "/" + item.child(i).text(0)) if __name__ == '__main__': # declare the GUI application app = QApplication([]) # apply the qdarkgraystyle darkgray_stylesheet = qdarkgraystyle.load_stylesheet() app.setStyleSheet(darkgray_stylesheet) # create the window object window = myP2PSync() # start the application sys.exit(app.exec_())
if self.password_info[1] == 3: holder = "Risky" if self.password_info[1] == 2: holder = "Medium" if self.password_info[1] == 1: holder = "Strong" else: holder = "Very Strong" self.password_output.setText(f"Password Strength: {holder}") def make_passphrase_if_button(self, s): self.password_info = self.backend.make_passphrase( self.password_input.text()) self.password_output.setText(f"Passphrase: {self.password_info}") def make_passphrase_if_return(self): self.password_info = self.backend.make_passphrase( self.password_input.text()) self.password_output.setText(f"Passphrase: {self.password_info}") def save_password(self, s): self.backend.write("passwords.txt", self.password_info) app = QApplication(sys.argv) window = MainWindow() window.setStyleSheet(dgs.load_stylesheet()) window.show() app.exec_()
super().__init__() self.setWindowTitle("三方包样式表") self.resize(500,500) self.setup_ui() def setup_ui(self): layout=QVBoxLayout(self) label=QLabel("xxx") btn=QPushButton("xx2") cb=QComboBox() cb.addItems(["1","2","3"]) sb=QSpinBox() layout.addWidget(label) layout.addWidget(btn) layout.addWidget(cb) layout.addWidget(sb) if __name__=='__main__': app=QApplication(sys.argv) form=Demo() form.show() import qdarkgraystyle sheet = qdarkgraystyle.load_stylesheet() #也可以用load_stylesheet_pyqt5 print(sheet) app.setStyleSheet(sheet) sys.exit(app.exec_())
def initUI(self): self.setWindowFlags(Qt.FramelessWindowHint) self.setWindowOpacity(0.9) self.setStyleSheet(qdarkgraystyle.load_stylesheet()) self.time_lab.setText(time.strftime("%Y-%m-%d", time.gmtime())) self.time_lab.setFont(QFont("雅黑", 12)) self.top_welcome_lab.setText(" 生活需要规划 , 理财拥有美好明天 ") self.close_btn = QPushButton("×", self) self.close_btn.resize(33, 33) self.mini_btn = QPushButton("-", self) self.mini_btn.resize(33, 33) self.max_btn = QPushButton("□", self) self.max_btn.resize(33, 33) self.mini_btn.setStyleSheet("QPushButton{\n" " font: 75 18pt \"微软雅黑\";\n" " border-radius: 3px;\n" " background-color: transparent;\n" " color: white;\n" "}\n" "QPushButton:hover{\n" " background-color: rgb(69, 209, 209);\n" "}\n" "QPushButton:pressed{\n" " background-color: rgb(97, 237, 237);\n" "}") self.max_btn.setStyleSheet("QPushButton{\n" " font: 75 18pt \"微软雅黑\";\n" " border-radius: 3px;\n" " background-color: transparent;\n" " color: white;\n" "}\n" "QPushButton:hover{\n" " background-color: rgb(69, 209, 209);\n" "}\n" "QPushButton:pressed{\n" " background-color: rgb(97, 237, 237);\n" "}") self.close_btn.setStyleSheet("QPushButton{\n" " font: 75 18pt \"微软雅黑\";\n" " border-radius: 3px;\n" " background-color: transparent;\n" " color: white;\n" "}\n" "QPushButton:hover{\n" " background-color: rgb(255, 28, 21);\n" "}\n" "QPushButton:pressed{\n" " background-color: rgb(255, 57, 53);\n" "}") self.close_btn.setToolTip("关闭") self.max_btn.setToolTip("最大化 / 普通") self.mini_btn.setToolTip("最小化") self.close_btn.clicked.connect(self.close) self.max_btn.clicked.connect(self.max_normal) self.mini_btn.clicked.connect(self.showMinimized) self.main_fun()
str(j_whole['-260']['1']['nam']['fnt'])) self.placeholder_date_issued.setText( str(datetime.fromtimestamp(j_whole['6']).date())) self.placeholder_valid_until.setText( str(datetime.fromtimestamp(j_whole['4']).date())) self.placeholder_cert_id.setText( str(j_whole['-260']['1']['t'][0]['ci'])) for K, V in CO.items(): if j_whole['1'] == K: c = V elif len(j_whole['1']) > 2: c = j_whole['1'] self.placeholder_CO.setText(str(c)) self.cert_type.setText("Test certificate") validity(j_whole, var, date_from, vall) return 1 #reset() return super(MyMainWindow, self).eventFilter(obj, event) if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) win = MyMainWindow() win.show() # Available build in styles # ['Breeze', 'Oxygen', 'QtCurve', 'Windows', 'Fusion'] # app.setStyle('Windows') app.setStyleSheet( qdarkgraystyle.load_stylesheet()) # this one is form the internet sys.exit(app.exec_())
def remove_old_log(): f = [] for (dirpath, dirnames, filenames) in os.walk(".log/"): f.extend([os.path.join(*dirpath.split("/"), s) for s in filenames]) tmp = [el for el in f if el[-4:] == ".txt"] len_tmp = len(tmp) if len_tmp >= 10: for el in sorted(tmp, reverse=True)[9:]: os.remove(el) sys.excepthook = fpd_except_handler if __name__ == "__main__": config.load_config() fpd_app = QtWidgets.QApplication() dark_mode_config = config.get_config("dark_mode") try: import qdarkgraystyle if dark_mode_config: plt.style.use('dark_background') fpd_app.setStyleSheet(qdarkgraystyle.load_stylesheet()) except ImportError: dark_mode_config = None window = ApplicationWindow(fpd_app, dark_mode_config) logger.setup(window._ui.log_text, window) window.show() sys.exit(fpd_app.exec_())
def __init__(self, parent=None): super(MyWindow, self).__init__(parent) self.sampled_frequency, self.noise_thr, self.audio_counter, self.rate_counter = 0, 0, 0, 0 #sampled frequency is needed throughout #noise threshold is an arbirtrary value calculated by the noise class #audio counter is required to cycle through extracted data to sonify # # self.noise_thr = 0 # self.audio_counter = 0 # self.rate_counter = 0 self.app = QtGui.QApplication([]) self.win = QtGui.QMainWindow() self.app.setStyleSheet( qdarkgraystyle.load_stylesheet()) #sets the theme area = DockArea() self.win.setCentralWidget(area) self.win.resize(1000, 320) self.win.setWindowTitle('User Interface') #set the main window # set the individual widget sizes and layout d1 = Dock("Data Management", size=(1000, 20)) d2 = Dock("Graph 1", size=(600, 50)) d3 = Dock("Settings 1", size=(400, 50)) d4 = Dock("Graph 2", size=(600, 50)) d5 = Dock("Settings 2", size=(400, 50)) d6 = Dock("Graph 3", size=(600, 50)) d7 = Dock("Settings 3", size=(400, 50)) d10 = Dock("Play", size=(1000, 20)) area.addDock(d1, 'top') area.addDock(d2, 'bottom', d1) area.addDock(d3, 'right', d2) area.addDock(d4, 'bottom', d2) area.addDock(d5, 'bottom', d3) area.addDock(d6, 'bottom', d4) area.addDock(d7, 'bottom', d5) area.addDock(d10, 'bottom') # set the individual widget sizes and layout #Create title widget - which will have instrument control and data management self.w1 = pg.LayoutWidget() self.w1.addWidget(QtGui.QLabel('Select Instrument'), row=0, col=0) self.w1.Instrument_selector = QtGui.QComboBox() self.w1.Instrument_selector.addItems(['Saxophone', 'Piano', 'Violin']) self.w1.addWidget(self.w1.Instrument_selector, row=0, col=1) #w1.addWidget(QtGui.QLineEdit()) d1.addWidget(self.w1) # create plot windows self.initArrays() self.askUser() self.NoiseCalc() self.dataLoad() self.xd = np.linspace(0, (1 / self.sampled_frequency) * len(self.raw_x), len(self.raw_x)) self.PlotWindow2 = pg.PlotWidget() self.PlotWindow4 = pg.PlotWidget() self.PlotWindow6 = pg.PlotWidget() d2.addWidget(self.PlotWindow2) d4.addWidget(self.PlotWindow4) d6.addWidget(self.PlotWindow6) self.plotline_w2 = self.PlotWindow2.plot() self.plotline_w2.setPen((200, 200, 100)) self.plotline_w4 = self.PlotWindow4.plot() self.plotline_w4.setPen((200, 200, 100)) self.plotline_w6 = self.PlotWindow6.plot() self.plotline_w6.setPen((200, 200, 100)) self.t = 0 self.n = 0 self.deque2 = deque(np.zeros(1000), maxlen=1000) self.deque4 = deque(np.zeros(1000), maxlen=1000) self.deque6 = deque(np.zeros(1000), maxlen=1000) # create plot windows # create settings windows #self.w3 = self.SettingsWidget() self.w3 = pg.LayoutWidget() self.w3.Movement_selector = QtGui.QComboBox(self) self.w3.Movement_selector.addItems([ 'Acceleration_x', 'Acceleration_y', 'Acceleration_z', 'Acceleration_r', 'Acceleration_theta', 'Acceleration_phi', 'Velocity_x', 'Velocity_y', 'Velocity_z', 'Velocity_r', 'Velocity_phi', 'Velocity_theta' ]) self.w3.Sound_selector = QtGui.QComboBox(self) self.w3.Sound_selector.addItems(['Amplitude', 'Spatial', 'Frequency']) self.w3.addWidget(self.w3.Movement_selector, row=0, col=0) self.w3.addWidget(self.w3.Sound_selector, row=1, col=0) #self.w3.Submit = QtGui.QPushButton('Submit', self) #self.w3.Submit.clicked.connect(self.PrintingAction3) #self.w3.addWidget(self.w3.Submit, row=2, col=0) self.w5 = pg.LayoutWidget() self.w5.Movement_selector = QtGui.QComboBox(self) self.w5.Movement_selector.addItems([ 'Acceleration_x', 'Acceleration_y', 'Acceleration_z', 'Acceleration_r', 'Acceleration_theta', 'Acceleration_phi', 'Velocity_x', 'Velocity_y', 'Velocity_z', 'Velocity_r', 'Velocity_phi', 'Velocity_theta' ]) self.w5.Sound_selector = QtGui.QComboBox(self) self.w5.Sound_selector.addItems(['Spatial', 'Amplitude', 'Frequency']) self.w5.addWidget(self.w5.Movement_selector, row=0, col=0) self.w5.addWidget(self.w5.Sound_selector, row=1, col=0) #self.w5.Submit = QtGui.QPushButton('Submit', self) #self.w5.Submit.clicked.connect(self.PrintingAction5) #self.w5.addWidget(self.w5.Submit, row=2, col=0) self.w7 = pg.LayoutWidget() self.w7.Movement_selector = QtGui.QComboBox(self) self.w7.Movement_selector.addItems([ 'Acceleration_x', 'Acceleration_y', 'Acceleration_z', 'Acceleration_r', 'Acceleration_theta', 'Acceleration_phi', 'Velocity_x', 'Velocity_y', 'Velocity_z', 'Velocity_r', 'Velocity_phi', 'Velocity_theta' ]) self.w7.Sound_selector = QtGui.QComboBox(self) self.w7.Sound_selector.addItems(['Frequency', 'Amplitude', 'Spatial']) self.w7.addWidget(self.w7.Movement_selector, row=0, col=0) self.w7.addWidget(self.w7.Sound_selector, row=1, col=0) #self.w7.Submit = QtGui.QPushButton('Submit', self) #self.w7.Submit.clicked.connect(self.PrintingAction7) #self.w7.addWidget(self.w7.Submit, row=2, col=0) self.w10 = pg.LayoutWidget() self.w10.Play = QtGui.QPushButton('Play', self) self.w10.Play.clicked.connect(self.playData) self.w10.addWidget(self.w10.Play, row=0, col=0) d3.addWidget(self.w3) d5.addWidget(self.w5) d7.addWidget(self.w7) d10.addWidget(self.w10) self.win.show()