def main(): app = QtGui.QApplication(sys.argv) mwin = EditorWindow() mwin.show() sys.exit(app.exec_())
def main(): app = QtGui.QApplication(sys.argv) ex = Example() sys.exit(app.exec_())
# "[^\n:]", "^[a-zA-Z0-9_.]+$", # objects "^[a-zA-Z0-9_.]+(.*\n*)$", # functions "^dir\([a-zA-Z0-9_.]+\)$", ] pattern = "|".join(pattern_list) if _re.match(pattern, code): return True return False def _clear_input(self): self._clear_text_edit(self.text_edit_input) def _clear_output(self): self._clear_text_edit(self.text_edit_output) def _clear_all(self): self._clear_input() self._clear_output() def _clear_text_edit(self, text_edit): text_edit.clear() if __name__ == "__main__": app = _QtGui.QApplication(_sys.argv) editor = CodeEditor() editor.show() _sys.exit(app.exec_())
def main(): app = QtGui.QApplication(sys.argv) speAna = SpeAna() speAna.show() sys.exit(app.exec_())
def main(): app = QtGui.QApplication(sys.argv) mainW = Controller() mainW.show() sys.exit(app.exec_())
def main(argv): app = QtGui.QApplication(argv) runner = controler.Kontroler() sys.exit(app.exec_())
if image_pixmap.isNull(): self.display_picture_label.setText( "<qt>Image not found. It might be a video, <a href='" + str(page_link) + "'>click here</a> to visit the page.</qt>") self.picture_title.setText(title) self.connect(self.display_picture_label, QtCore.SIGNAL("linkActivated(QString)"), self.open_URL) self.download_button.setEnabled(False) else: self.display_picture_label.setPixmap(image_pixmap) self.picture_title.setText(title) self.download_button.setEnabled(True) self.next_button.setEnabled(True) self.prev_button.setEnabled(True) def open_URL(self, URL): QtGui.QDesktopServices().openUrl(QtCore.QUrl(URL)) def download_image(self): self.download_image_thread = DownloadImageThread(self.download_link) self.download_image_thread.start_thread() if __name__ == '__main__': APODPhotoViewerMain = QtGui.QApplication(sys.argv) APODPhotoViewer = APODPhotoViewer() APODPhotoViewer.showMaximized() sys.exit(APODPhotoViewerMain.exec_())
def main(): app=QtGui.QApplication(sys.argv) ex=winForm() sys.exit(app.exec_())
""" import sys import threading import os from PyQt4 import QtGui, QtCore # other programs module from common_qt_app.helpers import give_name2thread from reminders_modules.tray import TrayController if __name__ == '__main__': give_name2thread('main_reminder_thread', threading.current_thread()) app = QtGui.QApplication(sys.argv) # start GUI Application and give args # load translations translator = QtCore.QTranslator(app) translator.load(os.path.join( sys.path[0], 'i18n', 'reminder_%s.qm' % QtCore.QLocale().name() )) app.installTranslator(translator) # set icon used in taskbar, when settings opened app_icon = QtGui.QIcon(os.path.join( sys.path[0], 'resources', 'moonOnBlue256.png'
def main(): app = QtGui.QApplication(sys.argv) ex = PlotTest() sys.exit(app.exec_())
def main(): app = QtGui.QApplication(sys.argv) ex = MiFormulario() sys.exit(app.exec_())
def main(): app = QtGui.QApplication(sys.argv) ex = PumpControl() ret = app.exec_() ex.shutdown() sys.exit(ret)
def main(argc, argv): from gainos_studio import mwgainostk app = QtGui.QApplication(argv); wMainWin = mwgainostk(argc,argv); wMainWin.show(); sys.exit(app.exec_());
def run(): app = QtGui.QApplication(sys.argv) myapp = MyForm() myapp.show() myapp.showLoginDialog() sys.exit(app.exec_())
def main(): import sys app = QtGui.QApplication(sys.argv) win = Window() sys.exit(win.exec())
def main(): app = QtGui.QApplication(sys.argv) ex = HW5W() ex.animate() sys.exit(app.exec_())
def launch_qct(ui, repo, *extras, **opts): """start qct commit tool If '.' is given as an argument the tool will operate out of the current directory, else it will operate repository-wide. This command will open a window from which you can browse all of the commitable changes you have made to your working directory. You can then enter a log message and commit your changes to the repository. You can remove files from the commit list by de-selecting them in the file list. Keyboard Shortcuts: CTRL-O - Commit selected files CTRL-R - Refresh file list CTRL-N - View diffs of next file in list CTRL-[] - Page up/down through file diffs CTRL-U - Unselect all files CTRL-F - Clear file filter text ESC - Abort and exit """ rundir = repo.root if '.' in extras: rundir = '.' os.chdir(rundir) # If this user has a username validation hook enabled, # it could conflict with Qct because both will try to # allocate a QApplication, and PyQt doesn't deal well # with two app instances running under the same context. # To prevent this, we run the hook early before Qct # allocates the app try: from hgconf.uname import hook hook(ui, repo) except ImportError: pass try: import qctlib except ImportError: import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) try: from PyQt4 import QtGui from qctlib.gui_logic import CommitTool from qctlib.vcs.hg import qctVcsHg except ImportError: # If we're unable to import Qt4 and qctlib, try to # run the application directly # You can specificy it's location in ~/.hgrc via # [qct] # path= try: udata = " -u %s" % opts['user'][-1] except: udata = '' cmd = ui.config("qct", "path", "qct") + udata + " --hg" os.system(cmd) else: import sys vcs = qctVcsHg() if hasattr(commands, "dispatch"): # 0.9.4 and below if vcs.initRepo(None, commands) != 0: sys.exit() else: if vcs.initRepo(None, dispatch) != 0: sys.exit() # Pass along -I/-X and --user options to Mercurial back-end vcs.pluginOptions(opts) app = QtGui.QApplication([]) dialog = CommitTool(vcs) dialog.show() app.exec_()
def main(): app = QtGui.QApplication(sys.argv) gui = Gui() gui.login_screen() sys.exit(app.exec_())
def startup(): """Start the client/upgrade """ logger = logging.getLogger(__name__) logging.config.fileConfig("logging.ini", disable_existing_loggers=False) # Apply app configuration according the config file configure() # Internationalisation # translate() # Log the version of client (useful for remote debuging) logger.info("RPB desktop client version: " + ConfigDetails().version) logger.info("Qt version: " + QT_VERSION_STR) logger.info("PyQt version: " + PYQT_VERSION_STR) # Basic services svcDiagnostic = DiagnosticService() svcDiagnostic.ProxyDiagnostic() svcHttp = HttpConnectionService(ConfigDetails().rpbHost, ConfigDetails().rpbHostPort, UserDetails()) svcHttp.application = ConfigDetails().rpbApplication if ConfigDetails().proxyEnabled: svcHttp.setupProxy(ConfigDetails().proxyHost, ConfigDetails().proxyPort, ConfigDetails().noProxy) if ConfigDetails().proxyAuthEnabled: svcHttp.setupProxyAuth(ConfigDetails().proxyAuthLogin, ConfigDetails().proxyAuthPassword) # App log app = QtGui.QApplication(sys.argv) ConfigDetails().logFilePath = (str( QtCore.QDir.currentPath())) + os.sep + "client.log" # Startup if ConfigDetails().isUpgrading is None or ConfigDetails( ).isUpgrading == "False": # Check whether upgrade was done showNotify = False if ConfigDetails().upgradeFinished is not None and ConfigDetails( ).upgradeFinished == "True": # Start upgrade procedure svcUpgrade = UpgradeService() svcUpgrade.cleanup() msg = "RadPlanBio client has been successfully upgraded" showNotify = True # Continue with standard login dialog loginDialog = LoginDialog(svcHttp) if loginDialog.exec_() == QtGui.QDialog.Accepted: # Main application window ui = MainWindow() ui.show() # Upgrade completed notification if showNotify: reply = QtGui.QMessageBox.information(ui, "Upgrade completed", msg, QtGui.QMessageBox.Ok) if reply == QtGui.QMessageBox.Ok: showNotify = False # Automatic update check at startup if (ConfigDetails().startupUpdateCheck): # Load version from server, user details updated in login dialog latestSoftware = svcHttp.getLatestSoftware( ConfigDetails().identifier) if latestSoftware != None: latestVersion = str(latestSoftware.version) else: latestVersion = ConfigDetails().version cmp = lambda x, y: LooseVersion(x).__cmp__(y) canUpgrade = cmp(ConfigDetails().version, latestVersion) if canUpgrade < 0: ui.upgradePopup() currentExitCode = app.exec_() return currentExitCode else: ApplicationEntityService().quit() QtGui.qApp.quit() else: # Start updater (RadPlanBio-update.exe) if platform.system() == "Windows": if os.path.isfile("./update/RadPlanBio-update.exe"): QtCore.QProcess.startDetached("./update/RadPlanBio-update.exe") else: QtCore.QProcess.startDetached("python ./update/mainUpdate.py") elif platform.system() == "Linux": if os.path.isfile("./update/RadPlanBio-update"): QtCore.QProcess.startDetached("./update/RadPlanBio-update") else: QtCore.QProcess.startDetached("python ./update/mainUpdate.py") else: QtCore.QProcess.startDetached("python ./update/mainUpdate.py") # Close this one ApplicationEntityService().quit() QtGui.qApp.quit()
def main(): app = QtGui.QApplication(sys.argv) ex = PoligonosPaint() sys.exit(app.exec_())
def run(): app = QtGui.QApplication(sys.argv) GUI = Window() sys.exit(app.exec_())
def main(): #when this script is run directly or from python interpreter outside qgis app=QtGui.QApplication.instance() # checks if QApplication already exists if not app: # create QApplication if it doesnt exist app = QtGui.QApplication(sys.argv) MainWindow() sys.exit(app.exec_())#comment out when using Ipython
def run(self): app = QtGui.QApplication(sys.argv) # Do required QT init self.gui = self.guiClass() # Instantiate a GUI class object self.ready = True # Now we are ready to rock sys.exit(app.exec_())
def main(): app = QtGui.QApplication(sys.argv) ex = Gui(app) sys.exit(app.exec_())
# distintos cuando la aplicación es lanzada desde distintas rutas. # por ejemplo, en este caso ejecutaríamos desde la misma carpeta: # # gestiweb:~/Dropbox/Documentos/Docum$ cd source_code # gestiweb:~/Dropbox/Documentos/Docum/source_code$ cd pyqt_example # gestiweb:~/Dropbox/Documentos/Docum/source_code/pyqt_example$ python pyqt_example2.py # # pero también podemos hacerlo desde la carpeta padre: # # gestiweb:~/Dropbox/Documentos/Docum/source_code/pyqt_example$ cd .. # gestiweb:~/Dropbox/Documentos/Docum/source_code$ python pyqt_example/pyqt_example2.py # # si no tuvieramos esto en cuenta podemos encontrarnos con un error como este: # # IOError: [Errno 2] No existe el fichero o el directorio: 'example2.ui' app = QtGui.QApplication(sys.argv) # Creamos la entidad de "aplicación" ui_filepath = filedir("example2.ui") # convertimos la ruta a absoluta print "Loading UI FILE: '%s' . . . " % ui_filepath window = uic.loadUi(ui_filepath) # Cargamos un fichero UI externo # y nos devuelve el objeto listo para usar. print "done." window.show() # el método show asegura que se mostrará en pantalla. retval = app.exec_() # ejecutamos la aplicación. A partir de aquí perdemos el sys.exit(retval) # salimos de la aplicación con el valor de retorno adecuado.
def run_gui(*args, **kwargs): ''' Runs the IGMGuessesGui Command line or from Python Examples: 1. python ~/xastropy/xastropy/xguis/spec_guis.py 1 2. spec_guis.run_fitlls(filename) 3. spec_guis.run_fitlls(spec1d) ''' import argparse from specutils import Spectrum1D parser = argparse.ArgumentParser(description='Parser for XFitLLSGUI') parser.add_argument("flag", type=int, help="GUI flag (ignored)") parser.add_argument("in_file", type=str, help="Spectral file") parser.add_argument("-out_file", type=str, help="Output LLS Fit file") parser.add_argument("-smooth", type=float, help="Smoothing (pixels)") parser.add_argument("-lls_fit_file", type=str, help="Input LLS Fit file") parser.add_argument("-zqso", type=float, help="Use Telfer template with zqso") if len(args) == 0: pargs = parser.parse_args() else: # better know what you are doing! if isinstance(args[0], (Spectrum1D, tuple)): app = QtGui.QApplication(sys.argv) gui = XFitLLSGUI(args[0], **kwargs) gui.show() app.exec_() return else: # String parsing largs = ['1'] + [iargs for iargs in args] pargs = parser.parse_args(largs) # Output file try: outfil = pargs.out_file except AttributeError: outfil = None # Input LLS file try: lls_fit_file = pargs.lls_fit_file except AttributeError: lls_fit_file = None # Smoothing parameter try: smooth = pargs.smooth except AttributeError: smooth = 3. # Smoothing parameter try: zqso = pargs.zqso except AttributeError: zqso = None app = QtGui.QApplication(sys.argv) gui = XFitLLSGUI(pargs.in_file, outfil=outfil, smooth=smooth, lls_fit_file=lls_fit_file, zqso=zqso) gui.show() app.exec_()
def main(): """ This illustrates the use of rdesigneur to build a simple dendrite with spines, and then to resize them using spine fields. These are the fields that would be changed dynamically in a simulation with reactions that affect spine geometry. """ makeModel() elec = moose.element('/model/elec') elec.setSpineAndPsdMesh(moose.element('/model/chem/spine'), moose.element('/model/chem/psd')) caDend = moose.vec('/model/chem/dend/Ca') caHead = moose.vec('/model/chem/spine/Ca') caPsd = moose.vec('/model/chem/psd/Ca') eHead = moose.wildcardFind('/model/elec/#head#') graphs = moose.Neutral('/graphs') psdTab = moose.Table2('/graphs/psdTab', len(caPsd)).vec headTab = moose.Table2('/graphs/headTab', len(caHead)).vec dendTab = moose.Table2('/graphs/dendTab', len(caDend)).vec eTab = moose.Table('/graphs/eTab', len(eHead)).vec stimtab = moose.StimulusTable('/stim') stimtab.stopTime = 0.3 stimtab.loopTime = 0.3 stimtab.doLoop = True stimtab.vector = [ 1.0 + numpy.sin(x) for x in numpy.arange(0, 2 * PI, PI / 1000) ] estimtab = moose.StimulusTable('/estim') estimtab.stopTime = 0.001 estimtab.loopTime = 0.001 estimtab.doLoop = True estimtab.vector = [ 1e-9 * numpy.sin(x) for x in numpy.arange(0, 2 * PI, PI / 1000) ] for i in range(len(caPsd)): moose.connect(psdTab[i], 'requestOut', caPsd[i], 'getConc') for i in range(len(caHead)): moose.connect(headTab[i], 'requestOut', caHead[i], 'getConc') for i in range(len(caDend)): moose.connect(dendTab[i], 'requestOut', caDend[i], 'getConc') for i in range(len(eHead)): moose.connect(eTab[i], 'requestOut', eHead[i], 'getVm') moose.connect(stimtab, 'output', caDend, 'setConc', 'OneToAll') dend = moose.element('/model/elec/dend') moose.connect(estimtab, 'output', dend, 'setInject') moose.reinit() moose.start(1) head0 = moose.element('/model/elec/head0') shaft1 = moose.element('/model/elec/shaft1') head2 = moose.element('/model/elec/head2') # Here we scale the spine head length while keeping all vols constt. print("Spine 0: longer head, same vol\nSpine 1: longer shaft") print("Spine 2: Bigger head, same diffScale\n") elecParms = [(i.Rm, i.Cm, i.Ra) for i in (head0, shaft1, head2)] chemParms = [ i.volume for i in (caHead[0], caPsd[0], caHead[1], caPsd[1], caHead[2], caPsd[2]) ] elec.spine[0].headLength *= 4 # 4x length elec.spine[0].headDiameter *= 0.5 # 1/2 x dia # Here we scale the shaft length. Vols are not touched. elec.spine[1].shaftLength *= 2 # 2 x length #Here we scale the spine head vol while retaining diffScale = xArea/len # This gives 4x vol. hdia = elec.spine[2].headDiameter sdsolve = moose.element('/model/chem/spine/dsolve') elec.spine[2].headLength *= 2 # 2x length elec.spine[2].headDiameter *= numpy.sqrt(2) # sqrt(2) x dia hdia = elec.spine[2].headDiameter print("Checking scaling assertions: ") assertEq(elecParms[0][0] * 0.5, head0.Rm) assertEq(elecParms[0][1] * 2, head0.Cm) assertEq(elecParms[0][2] * 16, head0.Ra) assertEq(chemParms[0], caHead[0].volume) assertEq(chemParms[1] * 0.25, caPsd[0].volume) assertEq(elecParms[1][0] * 0.5, shaft1.Rm) assertEq(elecParms[1][1] * 2, shaft1.Cm) assertEq(elecParms[1][2] * 2, shaft1.Ra) assertEq(chemParms[2], caHead[1].volume) assertEq(chemParms[3], caPsd[1].volume) ratio = 2 * numpy.sqrt(2) assertEq(elecParms[2][0] / ratio, head2.Rm) assertEq(elecParms[2][1] * ratio, head2.Cm) assertEq(elecParms[2][2], head2.Ra) assertEq(chemParms[4] * 4, caHead[2].volume) assertEq(chemParms[5] * 2, caPsd[2].volume) print("\nAll assertions cleared") moose.start(2) for i in range(len(psdTab)): pylab.plot(psdTab[i].vector, label='PSD' + str(i)) pylab.legend() pylab.figure() for i in range(len(headTab)): pylab.plot(headTab[i].vector, label='head' + str(i)) pylab.legend() pylab.figure() for i in range(len(dendTab)): pylab.plot(dendTab[i].vector, label='dendCa' + str(i)) pylab.legend() pylab.figure() for i in range(len(eTab)): pylab.plot(eTab[i].vector, label='headVm' + str(i)) #print i, len( eTab[i].vector ), eTab[i].vector pylab.legend() pylab.show() app = QtGui.QApplication(sys.argv) #widget = mv.MoogliViewer( '/model' ) morphology = moogli.read_morphology_from_moose(name="", path='/model/elec') widget = moogli.MorphologyViewerWidget(morphology) widget.show() return app.exec_() quit()
if __name__ == "__main__": from PyQt4 import QtGui # (the example applies equally well to PySide) import pyqtgraph as pg from double_game_window import GridWithConsole from coordinate_game_Qt import QDbgConsole, GridWidget from GridEnvironment import GridEnvironment from environment import RandomInitializer ## Always start by initializing Qt (only once per application) app = QtGui.QApplication([]) ## Define a top-level widget to hold everything w = QtGui.QWidget() # w = GridWithConsole(width=500, height=500) ## Create some widgets to be placed inside btn = QtGui.QPushButton('press me') # text = QtGui.QLineEdit('enter text') listw = QtGui.QListWidget() text = QDbgConsole() grid_env = GridEnvironment(6, 6) grid_env.init_environment(RandomInitializer()) plot = GridWidget(width=500, height=400) plot.set_grid(grid_env) # w.grid.set_grid(grid_env) ## Create a grid layout to manage the widgets size and position layout = QtGui.QGridLayout() w.setLayout(layout) # Add widgets to the layout in their proper positions layout.addWidget(btn, 0, 0) # button goes in upper-left layout.addWidget(text, 1, 0, 1, 1) # text edit goes in middle-left
plot_input = getattr(np, current_func[ind])(plot_input) if marker_state: self.ax.plot(values, plot_input, color= current_color, marker= marker, markersize= marker_size) else: self.ax.plot(values, plot_input, color= current_color) self.ax.set_xlim(values[0], values[-1]) self.draw() #--- Class For Alignment ---# class MyQLabel(QtGui.QLabel): def __init__(self, label, ha='left', parent=None): super(MyQLabel, self).__init__(label,parent) if ha == 'center': self.setAlignment(QtCore.Qt.AlignCenter) elif ha == 'right': self.setAlignment(QtCore.Qt.AlignRight) else: self.setAlignment(QtCore.Qt.AlignLeft) if __name__ == '__main__': app = QtGui.QApplication(sys.argv) ui = FunctionViewer() ui.show() sys.exit(app.exec_())
def main(): uygulama = QtGui.QApplication(sys.argv) w = tabloOdev() uygulama.exec_()