def __init__(self): self._Application = QtGui.QApplication(sys.argv) self._CurrentFile = ReactionFile() self._buttonPressed = 0 self._Window = MainWindow() try: self._PointerFileToLastFile = open("last.ptr", "r") self._LastFileAddress = self._PointerFileToLastFile.read() self._PointerFileToLastFile.close() if ".rctn" in self._LastFileAddress: self._newfilebox = QMessageBox() self._newfilebox.setModal(True) self._newfilebox.setWindowTitle("Open most recent file?") self._newfilebox.setText( "The last file you opened was " + self._LastFileAddress + ". Would you like to open it now?" ) self._newfilebox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) self._newfilebox.setDefaultButton(QMessageBox.Ok) self._buttonPressed = self._newfilebox.exec_() if self._buttonPressed == QMessageBox.Ok: self._Window.open(self._LastFileAddress) except: self._PointerFileToLastFile = open("last.ptr", "w") self._PointerFileToLastFile.write("") self._PointerFileToLastFile.close() self._Window = MainWindow() sys.exit(self._Application.exec_())
def run(argv): """Parse command-line options and start Audiolog.""" parser = OptionParser(usage="audiolog [OPTIONS] [INPUT_DIR]...") parser.add_option("--no-gui", action="store_false", dest="showGUI", default=True, help="run program without GUI (on by default)") parser.add_option("-s", metavar="SORTED_DIR", dest="sortedPath", help="the directory correctly sorted music should be moved to") options, inputPaths = parser.parse_args(argv) configuration.loadConfigFile() if options.sortedPath: configuration.PATHS["SORTED"] = toUnicode(options.sortedPath) if inputPaths: configuration.PATHS["TO_SCAN"] = [toUnicode(path) for path in inputPaths] if options.showGUI: from PyQt4.QtGui import QApplication from gui.MainWindow import MainWindow app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() if inputPaths: mainWindow.start() app.exec_() elif not options.showGUI and inputPaths: logOutputs.append(sys.stdout) traverse.handleIt()
def main(opts,logger): root = QtGui.QApplication(sys.argv) client = DAQProvider(opts,logger,root) # Set up the GUI part gui=MainWindow(client.outqueue, client.inqueue, logger, opts,root) gui.show() root.exec_()
def main(opts, logger): root = QtGui.QApplication(sys.argv) client = DAQProvider(opts, logger, root) # Set up the GUI part gui = MainWindow(client.outqueue, client.inqueue, logger, opts, root) gui.show() root.exec_()
def __init__(self): app = QApplication(sys.argv) QApplication.setStyle(QStyleFactory.create('Fusion')) main_window = MainWindow() main_window.show() sys.exit(app.exec_()) #will not end until you close the program
def main(): root = Tk() icon = PhotoImage(file="resources/webserver.png") root.iconphoto(True, icon) root.title("PyWebServer") root.resizable(0, 0) main_window = MainWindow(root) main_window.pack() root.mainloop()
def start(self): self.main_window = MainWindow(None, self.announces, self.api) self.main_window.addPlugin('PainterPlugin', PainterPlugin) self.main_window.addPlugin('LayoutPlugin', LayoutPlugin) self.main_window.addPlugin('PlayerPlugin', PlayerPlugin) self.main_window.addPlugin('NameInfoPlugin', NameInfoPlugin) self.main_window.addPlugin('LogPlugin', LogPlugin) self.main_window.addPlugin('InfoDialogPlugin', InfoDialogPlugin) self.main_window.addPlugin('StatisticsPlugin', StatisticsPlugin)
class AutoTool: main_window = None def __init__(self): if not self.main_window: self.main_window = MainWindow(getMainWindow()) self.main_window.show() def delete(self): if getIsPointerValid(self.main_window): self.main_window.deleteLater()
class CSVTableController(AbstractTableController): """ Implements AbstractTableController class for *.CSV files tables """ def __init__(self): """ Default constructor """ AbstractTableController.__init__(self) self._user = None self._userRights = UserRights() self._model = None self._application = None self._mainWindow = None def start(self, loginFilePath): """ Reimplemented from AbstractTableController """ self._application = QtGui.QApplication(sys.argv) self._mainWindow = MainWindow(self) self._mainWindow.setVisible(False) loginDialog = LoginDialog(loginFilePath) QtCore.QObject.connect(loginDialog, QtCore.SIGNAL("userLoggedIn(QObject)"), self.userLoggedIn) loginDialog.setModal(True) loginDialog.show() sys.exit(self._application.exec_()) def userLoggedIn(self, user): """ Reimplemented from AbstractTableController """ if user == None or (user.login() == "" and user.password() == ""): self._application.exit() return self._user = user self._userRights = user.rights() self._mainWindow.setVisible(True) def openTable(self, tablePath): """ Reimplemented from AbstractTableController """ try: with open(tablePath) as testingObject: pass except IOError, exception: return OperationResult(False, None, "File error: " + exception.message) try: self._model = CSVTableModel(tablePath) except Exception, exception: return OperationResult(False, None, "Model error: " + exception.message)
def main(): app = QApplication(sys.argv) if "Oxygen" in QStyleFactory.keys(): app.setStyle( QStyleFactory.create("Oxygen") ) # try to set the Oxygen style elif "Fusion" in QStyleFactory.keys(): # if not the try Fusion app.setStyle( QStyleFactory.create("Fusion") ) Globals.icons["finish flag"].addPixmap( QPixmap("Ressources/icons/finish_flag.png"), QIcon.Disabled, QIcon.On) Globals.MainWindow = MainWindow() Globals.Screen = app.primaryScreen() taille = Globals.Screen.size() height = taille.height() width = taille.width() if False: Globals.MainWindow.setMaximumSize( taille ) Globals.MainWindow.resize( height, width ) Globals.MainWindow.Tab_Container.setMaximumSize(QSize( height , width - 40)) Globals.MainWindow.Tab_Container.setGeometry( QRect(0, 0, height, width - 40)) Globals.MainWindow.main() # Init Decoder interface for dec in pref.decoderList: print ( dec ) if pref.decoderList[ dec ]['active']: decoder_task( pref.decoderList[dec], dec ) for task in Globals.decoder: receive( task ) app.exec_()
def run_gui(args): from gui.MainWindow import MainWindow integrators = { 'euler': Euler(), 'leapfrog': Leapfrog(), 'hermite': Hermite() } try: integrator = integrators[args.integrator] except: print("Integrator must one of: euler, leapfrog, hermite") exit(-1) sim = simulation.SimRun(n_steps=args.n, n_stars=args.s, integrator=integrator) w = MainWindow(sim) w.simulate()
class Application(QApplication): def __init__(self, argv): super(Application, self).__init__(argv) self.plugin_handler = PluginHandler() self.window: MainWindow = None def launch(self) -> None: self.window = MainWindow(self) self.window.show() def restart(self): self.plugin_handler = PluginHandler() if self.window: self.window.close() args.cleanup() time.sleep(0.5) self.launch()
def login(self): s = Session() res = s.query(Staff).filter_by(login=unicode(self.ui.login.text()), passwd=unicode(self.ui.password.text())).all() if len(res): self.mv = MainWindow(res[0]) self.mv.show() self.close() s.close()
class LoginWindow(QDialog): def __init__(self): QDialog.__init__(self) self.ui=Ui_LoginWindow() self.ui.setupUi(self) QObject.connect(self.ui.buttonBox, SIGNAL("accepted()"), self, SLOT("login()")) # QObject.connect(self.ui.order_search_menu, SIGNAL("triggered()"), self, SLOT("show_orders_widget()")) @pyqtSlot() def login(self): s = Session() res = s.query(Staff).filter_by(login=unicode(self.ui.login.text()), passwd=unicode(self.ui.password.text())).all() if len(res): self.mv = MainWindow(res[0]) self.mv.show() self.close() s.close()
def main(): app = QApplication() apply_stylesheet(app, theme='dark_amber.xml') window = MainWindow() signal.signal(signal.SIGINT, sigint_handler) timer = QTimer() timer.start(500) timer.timeout.connect(lambda: None) sys.exit(app.exec_())
def start(self, loginFilePath): """ Reimplemented from AbstractTableController """ self._application = QtGui.QApplication(sys.argv) self._mainWindow = MainWindow(self) self._mainWindow.setVisible(False) loginDialog = LoginDialog(loginFilePath) QtCore.QObject.connect(loginDialog, QtCore.SIGNAL("userLoggedIn(QObject)"), self.userLoggedIn) loginDialog.setModal(True) loginDialog.show() sys.exit(self._application.exec_())
def mainGUI(): app = QApplication(sys.argv) try: # ajout de l'id de l'application myappid = 'ValentinLe.lecteur_musique' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) except AttributeError: pass # ajout de l'icone de l'application app.setWindowIcon(QIcon(QPixmap("assets/logo.ico"))) # couleurs pour la scrollBar palette = QPalette() palette.setColor(QPalette.Base, QColor("#454545")) palette.setColor(QPalette.Light, QColor("#454545")) app.setPalette(palette) # affichage de la fenetre principale board = Board() window = MainWindow(board) window.setWindowTitle("Musique") window.showMaximized() # window.show() sys.exit(app.exec_())
def main(): # Load the configuration file preferences = Preferences() # Create application app = QtGui.QApplication(sys.argv) # Load the Main Widget main_window = MainWindow(preferences) # Start the application sys.exit(app.exec_())
def login(self): userName=self.loginEntry.get() password=self.passwordEntry.get() user=UserController().findUser(userName) try: if(password==user.password): self.master.withdraw() MainWindow(user,root) print("LOGGING IN...") else: messagebox.showinfo("ERROR","INCORRECT PASSWORD") except: messagebox.showinfo("ERROR","INCORRECT LOGIN")
def run(argv): """Parse command-line options and start Audiolog.""" parser = OptionParser(usage="audiolog [OPTIONS] [INPUT_DIR]...") parser.add_option("--no-gui", action="store_false", dest="showGUI", default=True, help="run program without GUI (on by default)") parser.add_option( "-s", metavar="SORTED_DIR", dest="sortedPath", help="the directory correctly sorted music should be moved to") options, inputPaths = parser.parse_args(argv) configuration.loadConfigFile() if options.sortedPath: configuration.PATHS["SORTED"] = toUnicode(options.sortedPath) if inputPaths: configuration.PATHS["TO_SCAN"] = [ toUnicode(path) for path in inputPaths ] if options.showGUI: from PyQt4.QtGui import QApplication from gui.MainWindow import MainWindow app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() if inputPaths: mainWindow.start() app.exec_() elif not options.showGUI and inputPaths: logOutputs.append(sys.stdout) traverse.handleIt()
#!/usr/bin/env python3 import signal from gi.repository import Gtk from gui.MainWindow import MainWindow win = MainWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() signal.signal(signal.SIGINT, signal.SIG_DFL) Gtk.main()
import sys from PyQt5.QtWidgets import QApplication from gui.MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())
# -*- coding: utf-8 -*- """ Created on 20 janv. 2010 @author: Thomas Lété """ import sys sys.stdout = open("pyssh_stdout.log", "w") sys.stderr = open("pyssh_stderr.log", "w") from PyQt4 import QtGui from gui.MainWindow import MainWindow if __name__ == "__main__": app = QtGui.QApplication(sys.argv) myapp = MainWindow() myapp.show() myapp.raise_() sys.exit(app.exec_())
#!/usr/bin/env python3 import sys from PyQt4 import QtGui from gui.MainWindow import MainWindow # Program start application = QtGui.QApplication ( sys.argv ) main_window = MainWindow () main_window.show () sys.exit ( application.exec_ () )
# Assign a function to save configurations when the app is closed. app.aboutToQuit.connect(exitApplication) # Apply window style if config.windowStyle and config.windowStyle in QStyleFactory.keys(): app.setStyle(config.windowStyle) # Apply theme style if config.qtMaterial and config.qtMaterialTheme: apply_stylesheet(app, theme=config.qtMaterialTheme) config.theme = "dark" if config.qtMaterialTheme.startswith("dark_") else "default" else: app.setPalette(Themes.getPalette()) # Active verse number colour #config.activeVerseNoColour = config.activeVerseNoColourDark if config.theme == "dark" else config.activeVerseNoColourLight # Assign mainWindow to config.mainWindow, to make it acessible from user customised user script config.mainWindow = MainWindow() # Check screen size availableGeometry = app.desktop().availableGeometry(config.mainWindow) setupMainWindow(availableGeometry) # A container of functions to be run after UBA loaded history records on startup # This offers a way for startup plugins to run codes after history records being loaded. config.actionsRightAfterLoadingHistoryRecords = [] runStartupPlugins() # Run initial commands if config.populateTabsOnStartup: openBibleWindowContentOnNextTab, openStudyWindowContentOnNextTab = config.openBibleWindowContentOnNextTab, config.openStudyWindowContentOnNextTab forceGenerateHtml = config.forceGenerateHtml
with open(data_path, 'wb') as output: pickle.dump(currentOpenBook, output, pickle.HIGHEST_PROTOCOL) else: with open("lastActiveWorkspace.txt", "w") as file: file.write("") if __name__ == '__main__': atexit.register(exit_handler) app = QApplication(sys.argv) rootNode = Workspace("Workspace") app.model = rootNode app.selectionModel = rootNode app.actionManager = ActionManager() mainWindow = MainWindow() mainWindow.setWindowTitle("MuMijA") app.page = mainWindow.page app.mainWidget = mainWindow.central app.statusBar = mainWindow.statusBarLabel app.pageLabel = mainWindow.PageLabel app.tabWidget = mainWindow.tabs app.mainWindow = mainWindow mainWindow.show() item, ok = QInputDialog.getItem( QInputDialog(), "Restoration", "Restore last saved workspace, choose one option:", ["Restore", "Create new"], 0, False) if ok: if item == "Restore": with open("lastActiveWorkspace.txt", "r") as file:
import subprocess import sys ## A helper function for installing modules for this program if they are not existing. # # \param packageName Name of the package that shall be installed. def maybeInstall(packageName): if importlib.util.find_spec(packageName) is None: subprocess.check_call( [sys.executable, "-m", "pip", "install", packageName]) if __name__ == "__main__": # Update pip. #subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"]) # For file exchange with Git from PyQt5.QtWidgets import * from PyQt5 import QtCore app = QApplication(sys.argv) app.setApplicationVersion("1.0.0") from gui.MainWindow import MainWindow from core.Controller import Controller controller = Controller() window = MainWindow(controller) window.show() sys.exit(app.exec_())
def setUp(self): self.gui = MainWindow() self.char = Character.Character.Open(charfile)
def main(): app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())
def mainLoop(): mainWindow = MainWindow() mainWindow.mainloop()
def __init__(self): if not self.main_window: self.main_window = MainWindow(getMainWindow()) self.main_window.show()
def main(): # app = QtModule.QApplication(sys.argv) app_settings.setValue('version', __version__) app_settings.setValue('root', normPath(root)) project_filename = setDefaultValue('project_filename', 'meshadered.prj') temp_dir = setDefaultValue('temp', normPath(os.path.join(root, 'tmp'))) project_dir = setDefaultValue('project', normPath(os.path.join(root, 'samples'))) project_shaders = setDefaultValue( 'project_shaders', normPath(os.path.join(project_dir, 'shaders'))) project_textures = setDefaultValue( 'project_textures', normPath(os.path.join(project_dir, 'textures'))) shader_networks_dir = setDefaultValue( 'shader_networks', normPath(os.path.join(project_shaders, 'shn'))) shader_sources_dir = setDefaultValue( 'shader_sources', normPath(os.path.join(project_shaders, 'src'))) shader_output_dir = project_shaders lib_dir = setDefaultValue('lib', normPath(os.path.join(root, 'lib'))) node_dir = setDefaultValue('nodes', normPath(os.path.join(lib_dir, 'nodes'))) texture_dir = setDefaultValue('texture', normPath(os.path.join(lib_dir, 'textures'))) shaders_dir = setDefaultValue('shaders', normPath(os.path.join(lib_dir, 'shaders'))) archive_dir = setDefaultValue('archive', normPath(os.path.join(lib_dir, 'archives'))) include_dir = setDefaultValue('include', normPath(os.path.join(root, 'include'))) createMissingDirs( [temp_dir, lib_dir, project_dir, project_shaders, project_textures]) createMissingDirs([shader_networks_dir, shader_sources_dir]) createMissingDirs([node_dir, texture_dir, shaders_dir, archive_dir]) # include_dir supposed to be a list # # Recent projects/networks # setDefaultValue('recent_projects_max', 10) setDefaultValue('recent_networks_max', 10) # # setup globals # app_global_vars['version'] = getDefaultValue(app_settings, '', 'version') app_global_vars['RootPath'] = root app_global_vars['TempPath'] = temp_dir app_global_vars['ProjectPath'] = project_dir app_global_vars['ProjectShaders'] = project_shaders app_global_vars['ProjectTextures'] = project_textures app_global_vars['ProjectNetworks'] = shader_networks_dir app_global_vars['ProjectSources'] = shader_sources_dir app_global_vars['LibPath'] = lib_dir app_global_vars['NodesPath'] = node_dir app_global_vars['TexturePath'] = texture_dir app_global_vars['ShaderPath'] = shaders_dir app_global_vars['IncludePath'] = include_dir app_global_vars['TextureSearchPath'] = sanitizeSearchPath(texture_dir) app_global_vars['ShaderSearchPath'] = sanitizeSearchPath(shaders_dir) app_global_vars['ArchiveSearchPath'] = sanitizeSearchPath(archive_dir) app_global_vars['ProjectSearchPath'] = sanitizeSearchPath(project_dir) app_global_vars['ProjectSearchShaders'] = sanitizeSearchPath( project_shaders) app_global_vars['ProjectSearchTextures'] = sanitizeSearchPath( project_textures) # # Setup current renderer preset # defRenderer = setDefaultValue('defRenderer', '3Delight') preset = meRendererPreset(os.path.join(root, 'renderers.xml'), defRenderer) app_global_vars['RendererPreset'] = preset app_global_vars['RendererName'] = preset.currentPreset.RendererName app_global_vars['RendererFlags'] = preset.currentPreset.RendererFlags app_global_vars['ShaderCompiler'] = preset.currentPreset.ShaderCompiler app_global_vars['ShaderDefines'] = preset.currentPreset.ShaderDefines app_global_vars['ShaderInfo'] = preset.currentPreset.ShaderInfo app_global_vars['SLO'] = preset.currentPreset.ShaderExt app_global_vars['TextureMake'] = preset.currentPreset.TextureMake app_global_vars['TextureInfo'] = preset.currentPreset.TextureInfo app_global_vars['TextureViewer'] = preset.currentPreset.TextureViewer app_global_vars['TEX'] = preset.currentPreset.TextureExt createDefaultProject(app_settings, True) # check_if_exist = True if DEBUG_MODE: print 'TextureSearchPath = %s' % app_global_vars['TextureSearchPath'] print 'ShaderSearchPath = %s' % app_global_vars['ShaderSearchPath'] print 'ArchiveSearchPath = %s' % app_global_vars['ArchiveSearchPath'] print 'Renderer = %s' % app_global_vars['RendererName'] #app_global_vars[ 'RibPath' ] = '' #app_global_vars[ 'DisplayPath' ] = '' app_settings.beginGroup('WorkArea') #grid_enabled = bool( setDefaultValue( 'grid_enabled', True ).toString() ) grid_enabled = setDefaultValue('grid_enabled', True) grid_size = int(setDefaultValue('grid_size', 10)) grid_snap = setDefaultValue('grid_snap', True) reverse_flow = setDefaultValue('reverse_flow', False) straight_links = setDefaultValue('straight_links', True) app_settings.endGroup() app_settings.beginGroup('Colors') app_colors['rsl_node_bg'] = setDefaultValue('rsl_node_bg', app_colors['rsl_node_bg']) app_colors['rib_node_bg'] = setDefaultValue('rib_node_bg', app_colors['rib_node_bg']) app_colors['image_node_bg'] = setDefaultValue('image_node_bg', app_colors['image_node_bg']) app_colors['group_node_bg'] = setDefaultValue('group_node_bg', app_colors['group_node_bg']) app_settings.endGroup() from gui.MainWindow import MainWindow window = MainWindow() window.show() # It's exec_ because exec is a reserved word in Python sys.exit(app.exec_())
# coding: utf-8 import sys from PyQt5.QtWidgets import QApplication from core.DataBase import DataBase from gui.MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) db = DataBase() print(db.connect()) m = MainWindow() m.show() sys.exit(app.exec_())
def startGUI(): app = QtGui.QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_())
import wx from gui.MainWindow import MainWindow class SlidingPuzzle(wx.App): def OnInit(self): self.SetAppName("Sliding Puzzle") return True if __name__ == '__main__': app = SlidingPuzzle() mainWindow = MainWindow() mainWindow.Show() app.MainLoop()
class GUIModule(ModuleBase): def __init__(self): self.app = QApplication(sys.argv) def setup(self, sim): self.announces = sim.announces self.api = sim.api self.start() sim.showGUI = self.show def start(self): self.main_window = MainWindow(None, self.announces, self.api) self.main_window.addPlugin('PainterPlugin', PainterPlugin) self.main_window.addPlugin('LayoutPlugin', LayoutPlugin) self.main_window.addPlugin('PlayerPlugin', PlayerPlugin) self.main_window.addPlugin('NameInfoPlugin', NameInfoPlugin) self.main_window.addPlugin('LogPlugin', LogPlugin) self.main_window.addPlugin('InfoDialogPlugin', InfoDialogPlugin) self.main_window.addPlugin('StatisticsPlugin', StatisticsPlugin) def show(self): self.main_window.show() self.announces['playSteps'](0) # 在此发布 playSteps,以初始化各个窗口部件 self.app.exec_()
def main(): """The pyview main entry point""" global folderHelper, window # Build command line parser cmdLine = CommandLine(LocalizedVersion()) options = cmdLine.getOptions() # Load image format plugins ImageFormats.loadImageFormatPlugins() # Get initial directory folderHelper = FolderHelper(options) folderHelper.setLastOpenedFile(options.initialFile) startDir = folderHelper.getFileDialogInitialDirectory() # Get and configure App object app = QtGui.QApplication(sys.argv) #QtGui.QApplication.setStyle(QtGui.QStyleFactory.create("Cleanlooks")) # Create and set window window = MainWindow() window.setFileDialogDirectory(startDir) window.centerWindow() # Connections window.connect(window, QtCore.SIGNAL("openFileFinished(char*, bool)"), onFileLoaded) # Show the window window.show() # Load initial file if options.initialFile: window.openFile(options.initialFile) # Start the application return app.exec_()
def main () : #global root app = QtGui.QApplication ( sys.argv ) app_settings.setValue ( 'version', version ) app_settings.setValue ( 'root', normPath ( root ) ) project_filename = setDefaultValue ( 'project_filename', 'meshadered.prj' ) temp_dir = setDefaultValue ( 'temp', normPath ( os.path.join ( root, 'tmp' ) ) ) project_dir = setDefaultValue ( 'project', normPath ( os.path.join ( root, 'samples' ) ) ) project_shaders = setDefaultValue ( 'project_shaders', normPath ( os.path.join ( project_dir,'shaders' ) ) ) project_textures = setDefaultValue ( 'project_textures',normPath ( os.path.join ( project_dir,'textures' ) ) ) shader_networks_dir = setDefaultValue ( 'shader_networks', normPath ( os.path.join ( project_shaders,'shn' ) ) ) shader_sources_dir = setDefaultValue ( 'shader_sources', normPath ( os.path.join ( project_shaders,'src' ) ) ) shader_output_dir = project_shaders lib_dir = setDefaultValue ( 'lib', normPath ( os.path.join ( root, 'lib' ) ) ) node_dir = setDefaultValue ( 'nodes', normPath ( os.path.join ( lib_dir, 'nodes' ) ) ) texture_dir = setDefaultValue ( 'texture', normPath ( os.path.join ( lib_dir, 'textures' ) ) ) shaders_dir = setDefaultValue ( 'shaders', normPath ( os.path.join ( lib_dir, 'shaders' ) ) ) archive_dir = setDefaultValue ( 'archive', normPath ( os.path.join ( lib_dir, 'archives' ) ) ) include_dir = setDefaultValue ( 'include', normPath ( os.path.join ( root, 'include' ) ) ) createMissingDirs ( [ temp_dir, lib_dir, project_dir, project_shaders, project_textures ] ) createMissingDirs ( [ shader_networks_dir, shader_sources_dir ] ) createMissingDirs ( [ node_dir, texture_dir, shaders_dir, archive_dir ] ) # include_dir supposed to be a list # # Recent projects/networks # setDefaultValue ( 'recent_projects_max', 10 ) setDefaultValue ( 'recent_networks_max', 10 ) # # setup globals # app_global_vars [ 'version' ] = app_settings.value( 'version' ).toString() app_global_vars [ 'RootPath' ] = root app_global_vars [ 'TempPath' ] = temp_dir app_global_vars [ 'ProjectPath' ] = project_dir app_global_vars [ 'ProjectShaders' ] = project_shaders app_global_vars [ 'ProjectTextures' ] = project_textures app_global_vars [ 'ProjectNetworks' ] = shader_networks_dir app_global_vars [ 'ProjectSources' ] = shader_sources_dir app_global_vars [ 'LibPath' ] = lib_dir app_global_vars [ 'NodesPath' ] = node_dir app_global_vars [ 'TexturePath' ] = texture_dir app_global_vars [ 'ShaderPath' ] = shaders_dir app_global_vars [ 'IncludePath' ] = include_dir app_global_vars [ 'TextureSearchPath' ] = sanitizeSearchPath ( texture_dir ) app_global_vars [ 'ShaderSearchPath' ] = sanitizeSearchPath ( shaders_dir ) app_global_vars [ 'ArchiveSearchPath' ] = sanitizeSearchPath ( archive_dir ) app_global_vars [ 'ProjectSearchPath' ] = sanitizeSearchPath ( project_dir ) app_global_vars [ 'ProjectSearchShaders' ] = sanitizeSearchPath ( project_shaders ) app_global_vars [ 'ProjectSearchTextures' ] = sanitizeSearchPath ( project_textures ) # # Setup current renderer preset # defRenderer = setDefaultValue ( 'defRenderer', '3Delight' ) preset = meRendererPreset ( os.path.join ( root, 'renderers.xml' ), defRenderer ) app_global_vars [ 'RendererPreset' ] = preset app_global_vars [ 'RendererName' ] = preset.currentPreset.RendererName app_global_vars [ 'RendererFlags' ] = preset.currentPreset.RendererFlags app_global_vars [ 'ShaderCompiler' ] = preset.currentPreset.ShaderCompiler app_global_vars [ 'ShaderDefines' ] = preset.currentPreset.ShaderDefines app_global_vars [ 'ShaderInfo' ] = preset.currentPreset.ShaderInfo app_global_vars [ 'SLO' ] = preset.currentPreset.ShaderExt app_global_vars [ 'TextureMake' ] = preset.currentPreset.TextureMake app_global_vars [ 'TextureInfo' ] = preset.currentPreset.TextureInfo app_global_vars [ 'TextureViewer' ] = preset.currentPreset.TextureViewer app_global_vars [ 'TEX' ] = preset.currentPreset.TextureExt createDefaultProject ( app_settings, True ) # check_if_exist = True if DEBUG_MODE : print 'TextureSearchPath = %s' % app_global_vars [ 'TextureSearchPath' ] print 'ShaderSearchPath = %s' % app_global_vars [ 'ShaderSearchPath' ] print 'ArchiveSearchPath = %s' % app_global_vars [ 'ArchiveSearchPath' ] print 'Renderer = %s' % app_global_vars [ 'RendererName' ] #app_global_vars[ 'RibPath' ] = '' #app_global_vars[ 'DisplayPath' ] = '' app_settings.beginGroup ( 'WorkArea' ) #grid_enabled = bool( setDefaultValue( 'grid_enabled', True ).toString() ) grid_enabled = setDefaultValue ( 'grid_enabled', True ) grid_size = int ( setDefaultValue ( 'grid_size', 10 ) ) grid_snap = setDefaultValue ( 'grid_snap', True ) reverse_flow = setDefaultValue ( 'reverse_flow', False ) straight_links = setDefaultValue ( 'straight_links', True ) app_settings.endGroup () app_settings.beginGroup ( 'Colors' ) app_colors [ 'rsl_node_bg' ] = setDefaultValue ( 'rsl_node_bg', app_colors [ 'rsl_node_bg' ] ) app_colors [ 'rib_node_bg' ] = setDefaultValue ( 'rib_node_bg', app_colors [ 'rib_node_bg' ] ) app_colors [ 'image_node_bg' ] = setDefaultValue ( 'image_node_bg', app_colors [ 'image_node_bg' ] ) app_colors [ 'group_node_bg' ] = setDefaultValue ( 'group_node_bg', app_colors [ 'group_node_bg' ] ) app_settings.endGroup () from gui.MainWindow import MainWindow window = MainWindow () #, rendererPreset ) window.show () # It's exec_ because exec is a reserved word in Python sys.exit ( app.exec_ () )
# coding: utf-8 import sys from PyQt5.QtWidgets import QApplication from core.DataBase import DataBase from gui.MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) db = DataBase() db.connect() m = MainWindow() m.show() sys.exit(app.exec_())
from PyQt5.QtWidgets import QApplication from gui.MainWindow import MainWindow import sys if __name__ == "__main__": app = QApplication(sys.argv) window = MainWindow() sys.exit(app.exec_())
def run_replay(args): from gui.MainWindow import MainWindow sim = simulation.Player(args.replay) w = MainWindow(sim) w.simulate()
from fbs_runtime.application_context.PySide2 import ApplicationContext from PySide2.QtWidgets import QMainWindow, QApplication import sys from gui.MainWindow import MainWindow KEY_BIT_WIDTH = 16 SUFFIX_NAME = ".tjl" if __name__ == '__main__': appctxt = ApplicationContext() ex = MainWindow(KEY_BIT_WIDTH, SUFFIX_NAME) ex.show() sys.exit(appctxt.app.exec_())
class TestMainWindow(unittest.TestCase): def setUp(self): self.gui = MainWindow() self.char = Character.Character.Open(charfile) def test_load_misc(self): self.gui.LoadChar(self.char) self.assertEqual( self.gui.b.get_object('characterName').get_text(), 'Grognar') self.assertEqual( self.gui.b.get_object('playerName').get_text(), 'Grog') self.assertEqual( self.gui.b.get_object('profName').get_text(), 'Fighter') self.assertEqual(self.gui.b.get_object('charLevel').get_text(), '3') self.assertEqual( self.gui.b.get_object('experience').get_text(), '12345') def test_load_stats(self): self.gui.LoadChar(self.char) self.assertEqual( self.gui.b.get_object('statTable').get_property('n-columns'), 5) self.assertEqual( self.gui.b.get_object('statTable').get_property('n-rows'), 13) temp, bonus = self.gui.statWidgets['Constitution'] self.assertEqual(temp.get_text(), '100') self.assertEqual(bonus.get_text(), '15') temp, bonus = self.gui.statWidgets['Memory'] self.assertEqual(temp.get_text(), '50') self.assertEqual(bonus.get_text(), '0') temp, bonus = self.gui.statWidgets['Self Discipline'] self.assertEqual(temp.get_text(), '97') self.assertEqual(bonus.get_text(), '12') for row in self.gui.statStore: if row[TMH.StatListStore.col('Name')] == 'Agility': agRow = row elif row[TMH.StatListStore.col('Name')] == 'Presence': prRow = row self.assertEqual(agRow[TMH.StatListStore.col('Temporary')], 1) self.assertEqual(agRow[TMH.StatListStore.col('Bonus')], -15) self.assertEqual(prRow[TMH.StatListStore.col('Temporary')], 50) self.assertEqual(prRow[TMH.StatListStore.col('Bonus')], 0) agRow[TMH.StatListStore.col('obj')].Value = 100 self.gui.Update() self.assertEqual(agRow[TMH.StatListStore.col('Bonus')], 15) def test_load_skills(self): self.gui.LoadChar(self.char) for skIter in self.gui.skillStore.IterAll: skill, ranks, bonus = self.gui.skillStore.get( skIter, TMH.SkillTreeStore.col('obj'), TMH.SkillTreeStore.col('Ranks'), TMH.SkillTreeStore.col('Bonus')) if skill.Name == 'Elvish': self.assertEqual(ranks, 1) self.assertEqual(bonus, 9030) skill.Value = 15 self.gui.Update() skill, ranks, bonus = self.gui.skillStore.get( skIter, TMH.SkillTreeStore.col('obj'), TMH.SkillTreeStore.col('Ranks'), TMH.SkillTreeStore.col('Bonus')) self.assertEqual(ranks, 15) self.assertEqual(bonus, 9090) def test_load_items(self): self.gui.LoadChar(self.char) bookIter, earIter = list(self.gui.itemStore.IterAll) book = self.gui.itemStore.get(bookIter, TMH.ItemListStore.col('obj'))[0] ear = self.gui.itemStore.get(earIter, TMH.ItemListStore.col('obj'))[0] self.assertEqual( self.gui.itemStore.get(bookIter, TMH.ItemListStore.col('Name'))[0], 'Research Book') book.Name = 'Researchy Awesome Book' self.gui.Update() self.assertEqual( self.gui.itemStore.get(bookIter, TMH.ItemListStore.col('Name'))[0], 'Researchy Awesome Book') ear.Description = 'Maybe a bit transparent' self.gui.Update() self.assertEqual( self.gui.itemStore.get(earIter, TMH.ItemListStore.col('Description'))[0], 'Maybe a bit transparent')
#!/usr/bin/python import sys from PyQt4 import QtCore, QtGui from gui.MainWindow import MainWindow from gui.ProjectList import ProjectList from gui.ProjectArea import ProjectArea from gui.TaskAreaBlank import TaskAreaBlank if __name__ == "__main__": app = QtGui.QApplication(sys.argv) window = MainWindow() projectList = ProjectList() taskAreaBlank = TaskAreaBlank() projectArea = ProjectArea() projectArea.show() window.ui.projectListDock.setWidget(projectList) window.ui.taskAreaDock.setWidget(taskAreaBlank) window.ui.projectAreaLayout.addWidget(projectArea) window.show() sys.exit(app.exec_())
def main (): #global root app = QtGui.QApplication ( sys.argv ) app_settings.setValue ( 'root', normPath ( root ) ) temp_dir = setDefaultValue ( 'temp', normPath ( os.path.join ( root, 'tmp' ) ) ) project_dir = setDefaultValue ( 'project', normPath ( os.path.join ( root, 'samples' ) ) ) project_shaders = setDefaultValue ( 'project_shaders', normPath ( os.path.join ( project_dir,'shaders' ) ) ) project_textures = setDefaultValue ( 'project_textures',normPath ( os.path.join ( project_dir,'textures' ) ) ) shader_networks_dir = setDefaultValue ( 'shader_networks', normPath ( os.path.join ( project_shaders,'shn' ) ) ) shader_sources_dir = setDefaultValue ( 'shader_sources', normPath ( os.path.join ( project_shaders,'src' ) ) ) shader_output_dir = project_shaders lib_dir = setDefaultValue ( 'lib', normPath ( os.path.join ( root, 'lib' ) ) ) node_dir = setDefaultValue ( 'nodes', normPath ( os.path.join ( lib_dir, 'nodes' ) ) ) texture_dir = setDefaultValue ('texture', normPath ( os.path.join ( lib_dir, 'textures' ) ) ) shaders_dir = setDefaultValue ('shaders', normPath ( os.path.join ( lib_dir, 'shaders' ) ) ) archive_dir = setDefaultValue ('archive', normPath ( os.path.join ( lib_dir, 'archives' ) ) ) include_dir = setDefaultValue ('include', normPath ( os.path.join ( root, 'include' ) ) ) createMissingDirs ( [temp_dir, lib_dir, project_dir, project_shaders, project_textures] ) createMissingDirs ( [shader_networks_dir, shader_sources_dir] ) createMissingDirs ( [node_dir, texture_dir, shaders_dir, archive_dir, include_dir] ) # path(), filePath(), absolutePath(), and absoluteFilePath(). #print 'root = %s' % ( root ) #print 'lib_dir = %s' % ( lib_dir ) #print 'node_dir = %s' % ( node_dir ) # # setup globals # app_global_vars[ 'RootPath' ] = root app_global_vars[ 'TempPath' ] = temp_dir app_global_vars[ 'ProjectPath' ] = project_dir app_global_vars[ 'ProjectShaders' ] = project_shaders app_global_vars[ 'ProjectTextures' ] = project_textures app_global_vars[ 'ProjectNetworks' ] = shader_networks_dir app_global_vars[ 'ProjectSources' ] = shader_sources_dir app_global_vars[ 'LibPath' ] = lib_dir app_global_vars[ 'NodesPath' ] = node_dir app_global_vars[ 'TexturePath' ] = texture_dir app_global_vars[ 'ShaderPath' ] = shaders_dir app_global_vars[ 'IncludePath' ] = include_dir app_global_vars[ 'TextureSearchPath' ] = sanitizeSearchPath ( texture_dir ) app_global_vars[ 'ShaderSearchPath' ] = sanitizeSearchPath ( shaders_dir ) app_global_vars[ 'ArchiveSearchPath' ] = sanitizeSearchPath ( archive_dir ) app_global_vars[ 'ProjectSearchPath' ] = sanitizeSearchPath ( project_dir ) app_global_vars[ 'ProjectSearchShaders' ] = sanitizeSearchPath ( project_shaders ) app_global_vars[ 'ProjectSearchTextures' ] = sanitizeSearchPath ( project_textures ) app_global_vars[ 'Renderer' ] = app_renderer.getCurrentValue( 'renderer', 'name' ) app_global_vars[ 'RendererFlags' ] = app_renderer.getCurrentValue( 'renderer', 'flags' ) app_global_vars[ 'ShaderCompiler' ] = app_renderer.getCurrentValue( 'shader', 'compiler' ) app_global_vars[ 'ShaderDefines' ] = app_renderer.getCurrentValue( 'shader', 'defines' ) app_global_vars[ 'TEX' ] = app_renderer.getCurrentValue( 'texture', 'extension' ) app_global_vars[ 'SLO' ] = app_renderer.getCurrentValue( 'shader', 'extension' ) print 'TextureSearchPath = %s' % app_global_vars[ 'TextureSearchPath' ] print 'ShaderSearchPath = %s' % app_global_vars[ 'ShaderSearchPath' ] print 'ArchiveSearchPath = %s' % app_global_vars[ 'ArchiveSearchPath' ] print 'Renderer = %s' % app_global_vars[ 'Renderer' ] #app_global_vars[ 'RibPath' ] = '' #app_global_vars[ 'DisplayPath' ] = '' app_settings.beginGroup( 'WorkArea' ) #grid_enabled = bool( setDefaultValue( 'grid_enabled', True ).toString() ) grid_enabled = setDefaultValue ( 'grid_enabled', True ) grid_size = int( setDefaultValue ( 'grid_size', 10 ) ) grid_snap = setDefaultValue ( 'grid_snap', True ) reverse_flow = setDefaultValue ( 'reverse_flow', False ) straight_links = setDefaultValue ( 'straight_links', True ) app_settings.endGroup( ) from gui.MainWindow import MainWindow window = MainWindow () #, rendererPreset ) window.show () # It's exec_ because exec is a reserved word in Python sys.exit ( app.exec_ () )
# -*- coding: utf-8 -*- ''' Created on 28.03.2015 @author: Florian Luetkebohmert <*****@*****.**> ''' import sys from PyQt4.Qt import QApplication, QMainWindow from PyQt4.QtGui import QWidget from gui.MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) window = MainWindow() window.showFullScreen() window.run(30000) app.exec_()