Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def start_gui(config: Config) -> None:
"""
Initializing the Qt application. MainWindow takes care of initializing
the player and the API, and acts as the "main function" where everything
is put together.
"""
app = QApplication(['vidify'])
# Setting dark mode if enabled
if config.dark_mode:
logging.info("Enabling dark mode")
app.setStyleSheet(qdarkstyle.load_stylesheet_from_environment())
set_dark_mode()
app.setWindowIcon(QIcon(Res.icon))
window = MainWindow(config)
window.show()
sys.exit(app.exec_())
#----------------------------------------------------------------------
def exit(self):
""""""
self.active = False
self.thread.join()
QtWidgets.qApp.quit()
if __name__ == '__main__':
font = QtGui.QFont(u'微软雅黑', 12)
app = QtWidgets.QApplication([])
app.setFont(font)
app.setStyleSheet(qdarkstyle.load_stylesheet_from_environment())
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('RQDataService')
manager = RqDataManager()
manager.show()
app.exec_()
def __init__(self, options):
super().__init__()
if options.dark:
self.setStyleSheet(qdarkstyle.load_stylesheet_from_environment())
self.server_manager = ServerManager(options.dark)
QApplication.instance().aboutToQuit.connect(
self.server_manager.shutdown_all_servers)
self.tabwidget = NotebookTabWidget(
self, self.server_manager, dark_theme=options.dark)
if options.notebook:
self.tabwidget.open_notebook(options.notebook)
else:
self.tabwidget.maybe_create_welcome_client()
self.setCentralWidget(self.tabwidget)
self._setup_menu()
def _update_stylesheet(self, widget):
"""Update the background stylesheet to make it lighter."""
if is_dark_interface():
css = qdarkstyle.load_stylesheet_from_environment()
widget.setStyleSheet(css)
palette = widget.palette()
background = palette.color(palette.Window).lighter(150).name()
border = palette.color(palette.Window).lighter(200).name()
name = widget.__class__.__name__
widget.setObjectName(name)
extra_css = '''
{0}#{0} {{
background-color:{1};
border: 1px solid {2};
}}'''.format(name, background, border)
widget.setStyleSheet(css + extra_css)
pg.setConfigOptions(antialias=True)
self.p6 = self.addPlot(title="")
self.curve = self.p6.plot(pen='r')
def addData(self, xData, yData):
self.curve.setData(x = xData, y = yData)
def getImage(self, filename):
exporter = exporter = pyqtgraph.exporters.ImageExporter(self.scene())
exporter.export(filename)
if __name__ == '__main__':
w = PlotWidget()
w.show()
QtGui.QApplication.setStyleSheet(qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True))
QtGui.QApplication.instance().exec_()
def _update_stylesheet(self, widget):
"""Update the background stylesheet to make it lighter."""
# Update the stylesheet for a given widget at most once
# because Qt is slow to repeatedly parse & apply CSS
if id(widget) in self._styled_widgets:
return
self._styled_widgets.add(id(widget))
if is_dark_interface():
css = qdarkstyle.load_stylesheet_from_environment()
widget.setStyleSheet(css)
palette = widget.palette()
background = palette.color(palette.Window).lighter(150).name()
border = palette.color(palette.Window).lighter(200).name()
name = widget.__class__.__name__
widget.setObjectName(name)
extra_css = '''
{0}#{0} {{
background-color:{1};
border: 1px solid {2};
}}'''.format(name, background, border)
widget.setStyleSheet(css + extra_css)