Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 设置Windows底部任务栏图标
if 'Windows' in platform.uname() :
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')
# 初始化Qt应用对象
app = QtGui.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon(ICON_FILENAME))
app.setFont(BASIC_FONT)
# 设置Qt的皮肤
try:
f = file(SETTING_FILENAME)
setting = json.load(f)
if setting['darkStyle']:
import qdarkstyle
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
f.close()
except:
pass
# 初始化主引擎和主窗口对象
mainEngine = MainEngine()
mainWindow = MainWindow(mainEngine, mainEngine.eventEngine)
mainWindow.showMaximized()
# 在主线程中启动Qt事件循环
sys.exit(app.exec_())
def runCalendarEditor():
"""运行日历编辑器"""
try: # Python 2
reload(sys)
sys.setdefaultencoding('utf8')
except NameError: # Python 3
pass
app = QtWidgets.QApplication(sys.argv)
app.setFont(QtGui.QFont(u'微软雅黑', 12))
try:
import qdarkstyle
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
except:
pass
manager = CalendarManager()
manager.showMaximized()
sys.exit(app.exec_())
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
item = QtGui.QTableWidgetItem("Test")
item.setCheckState(QtCore.Qt.Checked)
ui.tableWidget.setItem(0, 0, item)
window.setWindowTitle("QDarkStyle example")
window.setWindowTitle("QDarkStyle example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=True))
# 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_()
self._pool = None
# Load the gui from file
self.app = app
guiloader = QUiLoader()
#print os.getcwd()
f = QtCore.QFile("gui/mainwindow.ui")
f.open(QtCore.QFile.ReadOnly)
self.ui = guiloader.load(f)
f.close()
# STYLE
# self.app.setStyle('Plastique')
with open('gui/style.stylesheet', 'r') as f:
style = f.read()
app.setStyleSheet(qdarkstyle.load_stylesheet() + style)
# INITIAL GLOBALS
self.viewerprevioustab = -1
self.timelineprevioustab = -1
self.experiment = config.experiment()
self.folderwatcher = watcher.newfilewatcher()
self.plugins = []
# ACTIONS
# Wire up action buttons
self.ui.findChild(QtGui.QAction, 'actionOpen').triggered.connect(self.dialogopen)
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
item = QtGui.QTableWidgetItem("Test")
item.setCheckState(QtCore.Qt.Checked)
ui.tableWidget.setItem(0, 0, item)
window.setWindowTitle("QDarkStyle example")
window.setWindowTitle("QDarkStyle example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
# 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 applySettings(self):
if Settings().globalStyle == 'white':
QtWidgets.QApplication.instance().setStyleSheet("")
self.frameRecents.setStyleSheet(home.frame_recent_white)
self.labelRecents.setStyleSheet(home.label_recent_white)
self.listWidgetRecents.setStyleSheet(home.list_recent_white)
else:
self.frameRecents.setStyleSheet(home.frame_recent_dark)
self.labelRecents.setStyleSheet(home.label_recent_dark)
self.listWidgetRecents.setStyleSheet(home.list_recent_dark)
if '5' in os.environ['QT_API']:
QtWidgets.QApplication.instance().setStyleSheet(
qdarkstyle.load_stylesheet_pyqt5())
else:
QtWidgets.QApplication.instance().setStyleSheet(
qdarkstyle.load_stylesheet(pyside=False))
self.statusbar.setVisible(Settings().displayStatusBar)
for i in range(self.tabWidgetEditors.count()):
self.tabWidgetEditors.widget(i).updateSettings()
self.setupIcons()
self.menuBar.setVisible(Settings().displayMenuBar)
if self.stackedWidget.currentIndex():
self.toolBarCode.setVisible(Settings().displayToolBar)
self.toolBarFile.setVisible(Settings().displayToolBar)
self.lblFormat.setText('Free format' if Settings().free_format else 'Fixed format')
def setupStyle(self, s):
if s.global_style == constants.DARK_STYLE:
QtWidgets.QApplication.instance().setStyleSheet(
qdarkstyle.load_stylesheet(pyside=False))
self.setupIcons()
def __init__(self, *args, **kwargs):
with open('xicam/gui/style.stylesheet', 'r') as f:
style = f.read()
style = (qdarkstyle.load_stylesheet() + style)
kernel_manager = QtInProcessKernelManager()
kernel_manager.start_kernel()
kernel = kernel_manager.kernel
kernel.gui = 'qt4'
kernel.shell.push(dict(plugins.plugins))
kernel_client = kernel_manager.client()
kernel_client.start_channels()
def stop():
kernel_client.stop_channels()
kernel_manager.shutdown_kernel()
control = RichJupyterWidget()
args.win_size = int(args.win_size / 4.0) * 4 # make sure the width of the image can be divided by 4
# initialize model and constrained optimization problem
model_class = locate('model_def.%s' % args.model_type)
model = model_class.Model(model_name=args.model_name, model_file=args.model_file)
opt_class = locate('constrained_opt_%s' % args.framework)
opt_solver = opt_class.OPT_Solver(model, batch_size=args.batch_size, d_weight=args.d_weight)
img_size = opt_solver.get_image_size()
opt_engine = constrained_opt.Constrained_OPT(opt_solver, batch_size=args.batch_size, n_iters=args.n_iters, topK=args.top_k,
morph_steps=args.morph_steps, interp=args.interp)
# initialize application
app = QApplication(sys.argv)
window = gui_design.GUIDesign(opt_engine, win_size=args.win_size, img_size=img_size, topK=args.top_k,
model_name=args.model_name, useAverage=args.average, shadow=args.shadow)
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False)) # comment this if you do not like dark stylesheet
app.setWindowIcon(QIcon('pics/logo.png')) # load logo
window.setWindowTitle('Interactive GAN')
window.setWindowFlags(window.windowFlags() & ~Qt.WindowMaximizeButtonHint) # fix window siz
window.show()
app.exec_()
def on_styleActionGroup_triggered(self, action):
""" Change current editor style """
self.ui.genericEditor.currentStyle = styles.getStyle(action.text())
stylesheet = ""
if action.text() == "Dark":
try:
import qdarkstyle
stylesheet = qdarkstyle.load_stylesheet()
except ImportError:
print "Failed to use the qdarkstyle. Please execute to fully use this theme."
QApplication.instance().setStyleSheet(stylesheet)