Exemplo n.º 1
0
    def __init__(self):
        '''
        Constructor
        '''
        qt4.QObject.__init__(self)

        self.view_mode = "R"

        self.cp1 = CircuitProfile(None)
        self.cp2 = CircuitProfile(None)
        self.cpgoal = CircuitProfile(None)

        self.ops = {}
        self.results = {"S1": {}, "S2": {}, "Change": {}, "Goal": {}}

        self.load_operations()
        # create the GUI app
        self.app = qt4.QApplication.instance()
        self.app.processEvents()
        # instantiate the main window
        self.ui = MainWindow(self)
        self.plots_S1 = Plots(self, self.ui, "S1", self.ui.mplS1)
        self.plots_S2 = Plots(self, self.ui, "S2", self.ui.mplS2)
        self.plots_S2.hide()
        # full screen
        self.ui.showMaximized()
        # start the Qt main loop execution, exiting from this script
        # with the same return code of Qt application
        sys.exit(self.app.exec_())

        self.log_file = open("log_file.txt", "w")
Exemplo n.º 2
0
    def __init__(self):
        super().__init__()
        self.app = QApplication(sys.argv)
        # self.MainWindow = MyQMainWindow()
        self.MainWindow = MainWindow()
        self.MainWindow.show()
        # self.MainWindow.setupUi(self.MainWindow)

        self.MainWindow.actionNew.triggered.connect(self.new_connect)
        self.MainWindow.actionImport.triggered.connect(self.import_connect)
        self.MainWindow.actionExport.triggered.connect(self.export_connect)

        self.new_ui = Ui_Form()
        self.new_QWidget = QWidget()
        self.new_QWidget.setWindowModality(Qt.ApplicationModal)
        self.new_ui.setupUi(self.new_QWidget)

        self.histroy_ui = Ui_history_ui()
        self.history_QWidget = QWidget()
        self.history_QWidget.setWindowModality(Qt.ApplicationModal)
        self.histroy_ui.setupUi(self.history_QWidget)
        self.histroy_ui.clear.clicked.connect(self.histroy_clear)

        self.import_ui_QWidget = QWidget()
        self.import_ui_QWidget.setWindowModality(Qt.ApplicationModal)
        self.import_ui = Import_UI(self.import_ui_QWidget)

        self.create_ui = Create_Ui_Form()
        self.create_QWidget = QWidget()
        self.create_QWidget.setWindowModality(Qt.ApplicationModal)
        self.create_ui.setupUi(self.create_QWidget)

        self.create_database_ui = Ui_create_database()
        self.create_database_QWidget = QWidget()
        self.create_database_QWidget.setWindowModality(Qt.ApplicationModal)
        self.create_database_ui.setupUi(self.create_database_QWidget)

        self.path = os.path.dirname(sys.argv[0])
        self.conn = sqlite3.connect('db/influx.db')
        self.get_server_list()
        self.signal.connect(self.exec_handler)
        self.MainWindow.execAction.triggered.connect(lambda: self.signal.emit())
        self.MainWindow.history_button.triggered.connect(self.show_history)
        self.MainWindow.tabWidget.tabCloseRequested.connect(self.tab_close)

        self.MainWindow.treeView.setContextMenuPolicy(Qt.CustomContextMenu)  # 打开右键菜单的策略
        self.MainWindow.treeView.customContextMenuRequested.connect(self.right_click_menu)  # 绑定事件

        self.influxDbClient = InfluxRegister()
        self.edit_context_menu = QMenu()  # 创建对象
        self.edit_context_flag = False
        self.qt_info = functools.partial(QMessageBox.information, self.MainWindow, '提示信息')
        self.qt_cri = functools.partial(QMessageBox.critical, self.MainWindow, '提示信息')
Exemplo n.º 3
0
def main():
    """Creates and runs the PriceChartingTool application."""

    # Parse command-line arguments.
    (options, args) = parseCommandlineArgs()

    # Set up the logger.

    # Parsing the log config file doesn't work on the current version
    # of cx_Freeze (on Windows and on Mac).  The author of cx_Freeze
    # knows about this bug and hopefully the next release of cx_Freeze
    # addresses this issue.  Until then, only parse the config file if
    # this file is referenced as a .py file.
    if sys.argv[0].split(".")[-1] == "py":
        logging.config.fileConfig(LOG_CONFIG_FILE)
    log = logging.getLogger("main")

    log.info("##########################################")
    log.info("# Starting " + sys.argv[0] + ", version " + APP_VERSION)
    log.info("##########################################")

    # Create the Qt application.
    app = QApplication(sys.argv)
    app.setApplicationName(APP_NAME)
    app.setWindowIcon(QIcon(":/images/rluu/appIcon.png"))

    # Turn off UIEffects so that the application runs faster when doing
    # X11 forwarding.
    app.setEffectEnabled(Qt.UI_AnimateMenu, False)
    app.setEffectEnabled(Qt.UI_FadeMenu, False)
    app.setEffectEnabled(Qt.UI_AnimateCombo, False)
    app.setEffectEnabled(Qt.UI_AnimateTooltip, False)
    app.setEffectEnabled(Qt.UI_FadeTooltip, False)
    app.setEffectEnabled(Qt.UI_AnimateToolBox, False)

    # Initialize the Ephemeris.
    Ephemeris.initialize()

    # Set a default location (required).
    Ephemeris.setGeographicPosition(-77.084444, 38.890277)

    # Create the main window for the app and show it.
    mainWindow = MainWindow(APP_NAME, APP_VERSION, APP_DATE, APP_AUTHOR,
                            APP_AUTHOR_EMAIL)
    mainWindow.show()

    # Cleanup and close the application when the last window is closed.
    app.lastWindowClosed.connect(Ephemeris.closeEphemeris)
    app.lastWindowClosed.connect(logging.shutdown)
    app.lastWindowClosed.connect(app.quit)

    return app.exec_()
Exemplo n.º 4
0
def main():
    app = QtGui.QApplication(sys.argv)

    #scene = BattlefieldScene()
    w = MainWindow()
    w.show()

    sys.exit(app.exec_())

    #   rh = RollHandler("20d6 5+ 4+")
    #   print rh.commandString
    #   rh.Roll()
    return
Exemplo n.º 5
0
def main():
    #============================================================================
    # check if the program is already running
    #============================================================================
    pid = str(os.getpid())
    pidfile = "~firestarter.pid"

    running = False

    if os.path.isfile(pidfile):  # pid file available?
        with open(pidfile, 'r') as pf:
            oldpid = pf.readlines()[0]
            if pidRunning(oldpid):  # process with pid still alive?
                running = True

    if running: sys.exit()
    else:
        with open(pidfile, 'w') as pf:
            pf.write(pid)

    #============================================================================
    # verify directory structure
    #============================================================================
    neededFolders = ("cache", "cache/icons", "cache/steam", "export")
    for folder in neededFolders:
        if not os.path.isdir(folder):
            os.makedirs(folder)

    #============================================================================
    # Start main program
    #============================================================================
    ret = MainWindow.RestartCode
    while ret == MainWindow.RestartCode:
        flushLogfiles(("parser.log", "steamapi.log"), 'utf-8')

        app = QtGui.QApplication(sys.argv)
        # run program
        mainWnd = MainWindow()
        mainWnd.show()

        ret = app.exec_()

        del mainWnd
        del app

    #============================================================================
    # cleanup and exit
    #============================================================================
    os.remove(pidfile)
    sys.exit(ret)
Exemplo n.º 6
0
def main():
    """"""
    qapp = create_qapp()

    event_engine = EventEngine()

    main_engine = MainEngine(event_engine)

    main_engine.add_gateway(CtpGateway)

    main_window = MainWindow(main_engine, event_engine)
    main_window.showMaximized()

    qapp.exec()
Exemplo n.º 7
0
def main(args):
    setup_logging(args)
    commit_hash = get_git_commit_hash()
    LOG.info("Starting the EPIC-narrator" +
             (" ({})".format(commit_hash) if commit_hash is not None else ""))

    if args.query_audio_devices:
        print(Recorder.get_devices())
        exit()

    if args.set_audio_device >= 0:
        LOG.info('Changing default mic device to {}'.format(args.set_audio_device))
        Recorder.set_default_device(args.set_audio_device)

    this_os = get_os()
    single_window = this_os in ['linux', 'windows']

    controller = Controller(this_os)
    main_window = MainWindow(controller, this_os, single_window=single_window)
    main_window.show()

    Gtk.main()
Exemplo n.º 8
0
def main():
    app = QApplication(argv)
    window = MainWindow()
    window.show()
    exit(app.exec_())
Exemplo n.º 9
0
'''
Created on Jun 18, 2018

@author: rameshpr
'''
from PyQt4 import QtGui
import sys
from ui import MainWindow

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    form = MainWindow()
    form.show()
    app.exec_()
Exemplo n.º 10
0
import sys
from PySide2.QtWidgets import QApplication

import ui.MainWindow  as MainWindow
import game_engine.GamesManager as GamesManager

if __name__ == "__main__":
    # Création de l'application Qt
    app = QApplication(sys.argv)

    # Création de la fenêtre principale
    mainWindow = MainWindow.MainWindow(GamesManager.GamesManager())

    # Affichage de la fenêtre à l'écran
    mainWindow.show()

    # Exécution de l'application
    sys.exit(app.exec_())
Exemplo n.º 11
0
#TODO don't have this as a global
mainWindow = None

if __name__ == '__main__':
  parser = argparse.ArgumentParser(description='BraidsTag server.')
  args = parser.parse_args()

  gameState = ServerGameState()

  main = ListeningThread(gameState)
  main.start()

  # Create Qt application
  app = QApplication(sys.argv)
  mainWindow = MainWindow(gameState, main)
  mainWindow.show()

  # Enter Qt main loop
  retval = app.exec_()

  for i in gameState.players.values():
    print(i)

  main.stop()
  gameState.terminate()

  #print >> sys.stderr, "\n*** STACKTRACE - START ***\n"
  #code = []
  #for threadId, stack in sys._current_frames().items():
  #    code.append("\n# ThreadID: %s" % threadId)
Exemplo n.º 12
0
	def callback_batterystate(self, data):
		try:
			self.main_window.set_battery_state(data.percentage * 100)
		except rospy.ROSInterruptException as e:
			rospy.logerr(e)
			pass

	def listener(self):
		rospy.init_node('listener', anonymous=True, log_level=rospy.DEBUG)
		rospy.Subscriber("/mavros/vfr_hud", VFR_HUD, self.callback_vfr_hud)
		rospy.Subscriber("/mavros/radio_status", RadioStatus, self.callback_radiostatus)
		rospy.Subscriber("/mavros/battery", BatteryState, self.callback_batterystate)
		self.main_window.msg.header.stamp = rospy.Time.now()
		self.main_window.pub.publish(self.main_window.msg)
		rospy.spin()

	def __init__(self, main_window):
		self.initial_altitude = 0
		self.init_set = False
		self.main_window = main_window
		self.listener()

if __name__ == "__main__":
	gui_ready = threading.Event()
	main_window = MainWindow(gui_ready)
	gui_thread = threading.Thread(target=main_window.run_gui_thread)
	gui_thread.start()
	gui_ready.wait()
	fcu = FCU(main_window)
Exemplo n.º 13
0
import logging
import os
from PyQt5 import QtGui, QtCore
from config import CONFIG, RESOURCE_DIR
from ui import MainWindow
from common import app, loop

app_icon = QtGui.QIcon()
for size in [16, 24, 32, 48]:
    app_icon.addFile(
        os.path.join(RESOURCE_DIR, 'img/%sx%s.ico' % (size, size)),
        QtCore.QSize(size, size))
app_icon.addFile(
    os.path.join(RESOURCE_DIR, 'img/app.ico'), QtCore.QSize(256, 256))
app.setWindowIcon(app_icon)

main_window = MainWindow(CONFIG)

if __name__ == '__main__':
    main_window.show()
    try:
        loop.run_until_complete(main_window.main_loop())
        loop.run_forever()
    except RuntimeError as e:
        logging.exception(e)
    except Exception as e:
        logging.exception(e)
        raise
    finally:
        loop.close()
Exemplo n.º 14
0
import sys

from PyQt5.QtWidgets import *

from ui import MainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)

    main_window = MainWindow.MainWindow()
    main_window.setWindowTitle('客户端启动器')
    main_window.setFixedSize(1280, 720)
    main_window.show()

    sys.exit(app.exec_())
Exemplo n.º 15
0
def main():

    app = QApplication([])
    w = MainWindow()
    w.show()
    app.exec_()
Exemplo n.º 16
0
def main():
    ui_file = os.path.realpath(os.path.dirname(sys.argv[0])) + '/ui.glade'

    main_window = MainWindow(ui_file)
    Gtk.main()
Exemplo n.º 17
0
def main():
    app = create_app()
    window = MainWindow()
    window.startBut.clicked.connect(functools.partial(startRl, window=window))
    window.show()
    app.exec_()
Exemplo n.º 18
0
#!/usr/bin/python
#### from https://www.blog.pythonlibrary.org/2018/05/30/loading-ui-files-in-qt-for-python/
import sys
from PySide2.QtWidgets import QApplication
from PySide2.QtCore import Qt, QCoreApplication
from ui import MainWindow

version = "0.0.0"

if __name__ == '__main__':
    QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
    app = QApplication(sys.argv)
    form = MainWindow('ui/mainwindow.ui', version)
    sys.exit(app.exec_())
Exemplo n.º 19
0
from PyQt4 import QtGui
from ui import MainWindow
import sys

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = MainWindow()
    myapp.show()
    sys.exit(app.exec_())
Exemplo n.º 20
0
import sys
import qdarkstyle
from PyQt4.QtGui import QApplication
from ui import MainWindow

if __name__ == "__main__":

    app = QApplication(sys.argv)
    desktopWidget = QApplication.desktop()
    screenRect = desktopWidget.screenGeometry()
    app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
    window = MainWindow(screenRect.width(), screenRect.height())
    window.setWindowTitle("model_view")
    window.show()
    sys.exit(app.exec_())
Exemplo n.º 21
0
import sys
import os

from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (
    QApplication, )
from PyQt5.QtCore import Qt

from ui import MainWindow

if __name__ == '__main__':
    # windows task bar icon fix
    if os.name == 'nt':
        import ctypes
        app_id = 'wysockipiotr.strobe'
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id)

    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
    QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)

    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()

    sys.exit(app.exec_())
Exemplo n.º 22
0
import sys
import qdarkstyle
import config
from PyQt4.QtGui import QApplication
from ui import MainWindow
from opt import ConstrainedOpt
from model import DCGANTest

if __name__ == "__main__":
    model = DCGANTest(config.nz, config.nsf, config.nvx, config.batch_size)
    model.restore(config.params_path)
    opt_engine = ConstrainedOpt(model)
    app = QApplication(sys.argv)
    app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
    window = MainWindow(opt_engine)
    window.setWindowTitle("voxel-dcgan")
    window.show()
    window.viewerWidget.interactor.Initialize()
    sys.exit(app.exec_())
Exemplo n.º 23
0
 def __init__(self):
     super().__init__()
     self.ui = MainWindow()
     self.ui.setupUi(self)
     self.show()  
Exemplo n.º 24
0
import sys
from PyQt5.QtWidgets import QApplication
from ui import MainWindow
import traceback
import multiprocessing as mp
import logging


def excepthook(excType, excValue, tracebackobj):
    traceback.print_tb(tracebackobj, None, None)
    print(excType, excValue)


sys.excepthook = excepthook

if __name__ == '__main__':
    logging.basicConfig(
        format=
        '[line:%(lineno)d] %(filename)s %(asctime)s %(levelname)s %(message)s',
        level=logging.NOTSET)
    mp.set_start_method('spawn', force=True)
    app = QApplication(sys.argv)
    mainwindow = MainWindow.MainWindow()
    mainwindow.show()
    sys.exit(app.exec_())
Exemplo n.º 25
0
            nargs='+',
            action=required_length(1, 2),
            help=
            "transforms the input using the specified script (optional arguments)"
        )

        args = parser.parse_args()
        if args.help:
            parser.print_help()
            sys.exit(0)

        if not args.encode and not args.decode and not args.script and not args.hash and not args.interactive:
            # Start GUI when no other parameters were used.
            try:
                app = QApplication(sys.argv)
                ex = MainWindow(context)
                sys.exit(app.exec_())
            except Exception as e:
                context.logger().error("Unexpected Exception: {}".format(e))
                sys.exit(1)

        if args.interactive:
            setup_syntax_completion()
            from ptpython.repl import embed
            print("{app_name} {app_version}".format(
                app_name=context.config().getName(),
                app_version=context.config().getVersion()))
            embed(globals=globals(), locals=locals())
            sys.exit(0)

        if not args.encode and not args.decode and not args.script and not args.hash:
Exemplo n.º 26
0
def main():
    app = QApplication(sys.argv)
    app.setApplicationName("Analyze images")
    my_window = MainWindow(950, 750)
    app.setActiveWindow(my_window)
    exit(app.exec_())
Exemplo n.º 27
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = MainWindow(app)
    window.show()
    app.exec()
Exemplo n.º 28
0
 def show_main_window(self):
     self.window = MainWindow()
     self.window.actionChangeDB.triggered.connect(self.show_login)
     self.window.show()