예제 #1
0
def main(*args, **kwargs):
    import os
    import sys
    import sip
    import numpy as np
    from PyQt5.QtWidgets import QApplication
    from .view.mainwindow import MainWindow

    sys._excepthook = sys.excepthook

    def exception_hook(exctype, value, traceback):
        sys._excepthook(exctype, value, traceback)
        sys.exit(-1)

    sys.excepthook = exception_hook

    # todo: it's an ugly workaround for PyQt stylesheets relative paths
    try:
        os.chdir(os.path.dirname(__file__))
    except Exception:
        pass

    np.seterr(all='raise')
    sip.setdestroyonexit(False)

    app = QApplication(sys.argv)

    main_window = MainWindow(app)
    ret_code = app.exec_()
    return ret_code
예제 #2
0
def main():
    # Creating the application
    app = 0
    app = QApplication(sys.argv)
    main = MainWindow()
    app.setActiveWindow(main)

    # Showing the right icon in the taskbar
    if platform.system() == "Darwin":
        # On MAC
        pass
    elif platform.system() == 'Windows':
        # On Windows
        myappid = 'Ste.Sport.TrackAnalyser.v0.1'  # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

    main.show()

    # I added this line to prevent the app from crashing on exit. The app was
    # closing fine when I was using pyqt4 and pyqt5 but started crashing when
    # I started using qtpy. This makes me think that my code is fine but
    # the way qtpy is implemented causes random behaviours on exit. After
    # trying different suggestions, this is the only one that works:
    sip.setdestroyonexit(False)

    sys.exit(app.exec_())
예제 #3
0
파일: main.py 프로젝트: minlexx/pyevemon
def start_gui():
    logger = core.logger.get_logger(__name__)
    logger.info('Qt gui starting, PyQt5 version: {}; sip version: {}'.format(
        PYQT_VERSION_STR, sip.SIP_VERSION_STR))

    sip.setdestroyonexit(False)
    ver = version.get_pyevemon_version()

    # flags are usually set BEFORE app object is created
    QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)

    app = QApplication(sys.argv)
    app.setApplicationVersion(ver['version'])
    app.setApplicationName(ver['app_name'])
    app.setApplicationDisplayName(ver['app_displayname'])
    app.setOrganizationDomain(ver['app_domain'])
    app.setOrganizationName(ver['author_name'])

    # print(app.applicationName(), app.applicationDirPath(), app.applicationPid())
    # print(app.applicationDisplayName(), app.applicationVersion())

    # do not forget to start ESI auth callback receiver
    core.esi_handler.esi_handler_start()

    mainwindow = gui_qt.mainwindow.QtEmMainWindow()
    mainwindow.show()

    return app.exec_()
예제 #4
0
파일: qt.py 프로젝트: ykonter/scikit-rf
def single_widget_application(widget_class, splash_screen=True, appid=u"skrf.qtapp", icon=cfg.skrf_icon):
    if appid:
        set_process_id(appid)

    app = QtWidgets.QApplication(sys.argv)

    setup_style()
    set_popup_exceptions()

    if splash_screen:
        splash, start_time = get_splash_screen()

    form = widget_class()
    try:
        if type(icon) is str:
            icon = QtGui.QIcon(icon)
        elif not isinstance(icon, QtGui.QIcon):
            icon = False
        if icon:
            form.setWindowIcon(icon)
    except Exception as e:
        error_popup(e)

    form.show()

    if splash_screen:
        close_splash_screen(form, splash, start_time)

    sip.setdestroyonexit(False)  # prevent a crash on exit
    sys.exit(app.exec_())
예제 #5
0
def main():
    import gui.mainwindow as mainwindow
    faulthandler.enable()

    sip.setdestroyonexit(True)

    try:
        #sip.setdestroyonexit(False)
        QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
        app = QtWidgets.QApplication(sys.argv)
        app.setStyle(MyProxyStyle())

        app.setOrganizationName("Scipyen")
        app.setApplicationName("Scipyen")

        gc.enable()

        #import pudb
        mainWindow = mainwindow.ScipyenWindow(app)

        mainWindow.show()

        app.exec()

    except Exception as e:
        #faulthandler.dump_traceback()
        traceback.print_exc()
예제 #6
0
def gui(start, config_file):
    if start:
        import sys
        from PyQt5.QtWidgets import QSystemTrayIcon
        from PyQt5.QtWidgets import QMessageBox
        from PyQt5.QtWidgets import QApplication
        from bot.utils.common import make_config_file, default_config
        from bot.duel_links_runtime import DuelLinkRunTime
        from bot.dl_gui import DuelLinksGui
        sip.setdestroyonexit(False)
        app = QApplication(sys.argv)

        if not QSystemTrayIcon.isSystemTrayAvailable():
            QMessageBox.critical(None, "Systray",
                                 "Systray not dected on system.")
            sys.exit(1)

        QApplication.setQuitOnLastWindowClosed(False)

        uconfig = default_config()
        uconfig.read(config_file)
        dlRuntime = setup_runtime(uconfig)
        dlRuntime.main()
        window = DuelLinksGui(dlRuntime, uconfig.get('locations', 'assets'))
        window.show()
        sys.exit(app.exec_())
예제 #7
0
def main():
    app = QtGui.QApplication(sys.argv)
    app.setStyle("plastique")
    stem_filter = MainWindow()
    stem_filter.show()
    sip.setdestroyonexit(False)
    sys.exit(app.exec_())
 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     self.initVar()
     self.initUI()
     self.initFeedCode()
     self.initStrikeList()
     self.initTableWidget()
     self.initThread()
     sip.setdestroyonexit(False)
예제 #9
0
def run_prog():
    version = "V1.14 - Commerical Trial"
    myappid = "JPBaero.PhotoDrop." + version  # arbitrary string
    ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
    app = QtGui.QApplication(sys.argv)
    app.setWindowIcon(QtGui.QIcon("icon.png"))
    sip.setdestroyonexit(True)
    window = MyWindow(version)
    sys.exit(app.exec_())
예제 #10
0
 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     self.initExpireDateUtil()
     self.initUI()
     sip.setdestroyonexit(False)
     self.initFeedCode()
     self.initStrikeList()
     self.initTableWidget()
     self.initThread()
     self.initTIMER()
     self.initData()
     self.onStart()
예제 #11
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self._loadUI()
     self.setCentralWidget(self.ui.webView)
     self.ui.webView.load(QtCore.QUrl(mainWindow._fromUtf8('http://www.uniz.cc/modelview/')))
     self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap('../icon/main_big.png')))
     self.setWindowTitle(mainWindow._fromUtf8('Uniz Software - Model View'))
     self.setStatusBar(QtGui.QStatusBar(self))
     self.statusBar().showMessage(mainWindow._fromUtf8('Uniz Software - Model View'))
     self._initToolbar()
     self._connectWebViewLinkClicked()
     sip.setdestroyonexit(False)
예제 #12
0
파일: __main__.py 프로젝트: sam-roth/Keypad
def main():
    _setup_logging() # needs to be done before using the logger

    import sys, sip, os.path
    
    from .qt import driver


    # As for memory, modern OSes handle that just fine, so we don't need to free
    # memory on exiting. The GC does this in a non-deterministic order, which can
    # cause SEGVs. Other resources may be left open by this, but it's generally
    # not okay to rely on GC for those anyway, so we shouldn't be any worse off.
    sip.setdestroyonexit(False) 

    # Add the `third-party` dir into the path.
    thirdparty = os.path.abspath(os.path.join(os.path.dirname(__file__), 
                                              os.path.pardir,
                                              'third-party'))
    sys.path.insert(0, thirdparty)

    from . import config, options
    
    # Allow for sending a commandline command at startup.
    if len(sys.argv) > 2 and sys.argv[1] == '-c':
        from .core.notification_queue import run_in_main_thread
        from .control.command_line_interpreter import CommandLineInterpreter
        from .abstract.application import app, AbstractApplication
        from .core.errors import NoSuchCommandError

        interp = CommandLineInterpreter()

        def win_creation_hook(win):
            # Responder chain may not be updated yet.
            try:
                interp.exec(app(), sys.argv[2])
            except NoSuchCommandError:
                interp.exec(win, sys.argv[2])
            finally:
                app().window_created.disconnect(win_creation_hook)

        def app_creation_hook(_):
            app().window_created.connect(win_creation_hook)


        AbstractApplication.application_created.connect(app_creation_hook)


    driver.main()
예제 #13
0
 def __init__(self,parent=None):
     QtGui.QWidget.__init__(self,parent)
     pg.setConfigOption('background', 'w')
     pg.setConfigOption('foreground', 'k')
     self.setWindowTitle(u"Решение параболических дифференциальных уравнений")
     self.resize(800,600)
     self.createControls()
     self.fillLayouts()
     self.explicitGraphModel = ExplicitGraphModel()
     self.implicitGraphModel = ImplicitGraphModel()
     self.mixedGraphModel = MixedGraphModel(self.explicitGraphModel,self.implicitGraphModel,AppConsts.Q)
     self.activeGraphModel = self.explicitGraphModel
     self.taskChange(0)
     self.refreshView()
     self.approxComboBox.currentIndexChanged.connect(self.recompute)
     self.approxInitComboBox.currentIndexChanged.connect(self.recompute)
     sip.setdestroyonexit(False)
예제 #14
0
 def __init__(self):
     """
     Init, fairly standard. The setdestroyonexit call looks hacky, but I don't think it is.
     """
     sip.setdestroyonexit(False)
     self.settings = QtCore.QSettings('glimmer', 'glimmer')
     self._checkSettings()
     super(Window, self).__init__()
     self.createSettingsGroupBox()
     self.createActions()
     self.createTrayIcon()
     mainLayout = QtGui.QHBoxLayout()
     mainLayout.addWidget(self.settingsGroupBox)
     self.setLayout(mainLayout)
     self.trayIcon.show()
     self.setWindowTitle("glimmer Settings")
     self.resize(500, 150)
     self.settings.setValue('lastKnownClipboard', '')
예제 #15
0
def single_widget_application(widget_class, splash_screen=True):
    app = QtWidgets.QApplication(sys.argv)

    setup_style()
    set_popup_exceptions()

    if splash_screen:
        splash, start_time = get_splash_screen()

    form = widget_class()
    form.setWindowIcon(get_skrf_icon())
    form.show()

    if splash_screen:
        close_splash_screen(form, splash, start_time)

    sip.setdestroyonexit(False)  # prevent a crash on exit
    sys.exit(app.exec_())
예제 #16
0
def pre_qapp_initialization():
    Qt.QApplication.setAttribute(Qt.Qt.AA_ShareOpenGLContexts)
    sip.setdestroyonexit(False)

    global GL_QSURFACE_FORMAT
    assert GL_QSURFACE_FORMAT is None
    GL_QSURFACE_FORMAT = Qt.QSurfaceFormat()
    GL_QSURFACE_FORMAT.setRenderableType(Qt.QSurfaceFormat.OpenGL)
    GL_QSURFACE_FORMAT.setVersion(2, 1)
    GL_QSURFACE_FORMAT.setProfile(Qt.QSurfaceFormat.CompatibilityProfile)
    GL_QSURFACE_FORMAT.setSwapBehavior(Qt.QSurfaceFormat.DoubleBuffer)
    GL_QSURFACE_FORMAT.setStereo(False)
    GL_QSURFACE_FORMAT.setSwapInterval(SWAP_INTERVAL)
    GL_QSURFACE_FORMAT.setSamples(MSAA_SAMPLE_COUNT)
    GL_QSURFACE_FORMAT.setRedBufferSize(8)
    GL_QSURFACE_FORMAT.setGreenBufferSize(8)
    GL_QSURFACE_FORMAT.setBlueBufferSize(8)
    GL_QSURFACE_FORMAT.setAlphaBufferSize(8)
    Qt.QSurfaceFormat.setDefaultFormat(GL_QSURFACE_FORMAT)
예제 #17
0
    def __init__(self):
        super(MainForm, self).__init__()
        self.initUI()
        self.redis_client = redis.Redis()
        self.position_entity_dict = {}
        self.position_dict = {}
        self.avgexecprice_dict = {}
        self.liveqty_dict = {}
        self.ask1_dict = {}
        self.bid1_dict = {}
        self.total_pnl = 0
        self.orderseq = list()
        self.order_qu = collections.deque()
        self.order_cnt = 0

        self.autotrader_id = 'OTM001'
        self.order_port = 6001  # real 6000
        self.exec_report_port = 7001  # real 7000

        self.qtimer = QtCore.QTimer()
        self.qtimer.timeout.connect(self.on_timer)

        self.initStrikeList()
        self.initThread()
        self._session = position_db_init.initSession('autotrader_position.db')
        self.init_quote_dict()
        self.updatePostionTable()
        # self.init_orderseq()

        self.atm_strike = self.find_atm_strike()

        call_shortcd = self.find_target_shortcd('call')
        put_shortcd = self.find_target_shortcd('put')

        logger.info('======= target option shortcd ======')
        logger.info('atm_strike-> %s' % self.atm_strike)
        logger.info('target call option-> %s' % call_shortcd)
        logger.info('target put option-> %s' % put_shortcd)
        logger.info('====================================')

        sip.setdestroyonexit(False)
예제 #18
0
def main(*args, **kwargs):
    import os
    import sys
    import sip
    import numpy as np

    sys._excepthook = sys.excepthook
    def exception_hook(exctype, value, traceback):
        sys._excepthook(exctype, value, traceback)
        sys.exit(-1)
    sys.excepthook = exception_hook

    np.seterr(all='raise')
    sip.setdestroyonexit(False)

    from PyQt5.QtWidgets import QApplication
    app = QApplication(sys.argv)

    from .view.mainwindow import MainWindow
    main_window = MainWindow(app)
    ret_code = app.exec_()
    return ret_code
예제 #19
0
def main(*args, **kwargs):
    import os
    import sys
    import sip
    import numpy as np

    # todo: it's an ugly workaround for PyQt stylesheets relative paths
    try:
        os.chdir(os.path.dirname(__file__))
    except Exception:
        pass

    from PyQt4 import QtGui
    from .view.mainwindow import MainWindow

    np.seterr(all='raise')
    sip.setdestroyonexit(False)

    app = QtGui.QApplication(sys.argv)
    main_window = MainWindow(app)
    ret_code = app.exec_()
    return ret_code
예제 #20
0
def gui(start, config_file):
    if start:
        import sys
        from PyQt5.QtWidgets import QSystemTrayIcon
        from PyQt5.QtWidgets import QMessageBox
        from PyQt5.QtWidgets import QApplication
        from bot.utils.common import make_config_file, default_config
        from bot.duel_links_runtime import DuelLinkRunTime
        from bot.dl_gui import DuelLinksGui
        from bot import logger
        sip.setdestroyonexit(False)
        app = QApplication(sys.argv)

        if not QSystemTrayIcon.isSystemTrayAvailable():
            QMessageBox.critical(None, "Systray",
                                 "Systray not dected on system.")
            sys.exit(1)

        QApplication.setQuitOnLastWindowClosed(False)

        uconfig = default_config()
        uconfig.read(config_file)
        dlRuntime = setup_runtime(uconfig)
        dlRuntime.main()
        window = DuelLinksGui(dlRuntime, uconfig.get('locations', 'assets'))
        window.show()

        def handler(signum, frame):
            if signum == signal.SIGINT:
                window.__quit__()
                logger.info("Exiting Yugioh-DuelLinks Bots")

        signal.signal(signal.SIGINT, handler)

        def inmain():
            return app.exec_()

        sys.exit(inmain())
예제 #21
0
def get_application(name=''):
    """
    Initialise and return the global application object
    :param name: Optional application name
    :return: Global appliction object
    """
    global _QAPP

    def exception_handler(exctype, value, tb):
        traceback.print_exception(exctype, value, tb)
        sys.exit(1)

    if _QAPP is None:
        setup_library_paths()
        _QAPP = QApplication([name])
        if PYQT4:
            # Do not destroy C++ Qtcore objects on exit
            # Matches PyQt5 behaviour to avoid random segfaults
            # https://www.riverbankcomputing.com/static/Docs/PyQt5/pyqt4_differences.html#object-destruction-on-exit
            sip.setdestroyonexit(False)
        sys.excepthook = exception_handler

    return _QAPP
예제 #22
0
파일: main.py 프로젝트: lindnerlars/pyplane
    def __init__(self):
        # superclass constructor
        PyplaneMainWindow.__init__(self)
        QtCore.pyqtRemoveInputHook()

        # If set to True the app crashes under MS Windows if it is immediately closed after startup without any
        # further actions
        sip.setdestroyonexit(False)

        # Set Version-number
        self.setWindowTitle("PyPlane " + self.__PYPLANE_VERSION)

        # check config file if shown by default
        self.terminal_toggle = myConfig.get_boolean("Logging",
                                                    "log_showTerminal")
        self.update_terminal()

        # # connect buttons ------------------------------------------------------
        # # connect buttons: system
        self.clearButton.clicked.connect(self.clear_trajectories)
        self.submitButton.clicked.connect(self.submit)

        # # connect buttons: additional function
        self.FctPlotButton.clicked.connect(self.add_function)
        self.FctClearButton.clicked.connect(self.remove_functions)

        # file menu ------------------------------------------------------
        # file
        self.file_menu = QtWidgets.QMenu('&System', self)

        self.load = QtWidgets.QMenu('&Open', self)
        self.file_menu.addMenu(self.load)
        self.load.addAction('&Recent', self.load_tmp_system)
        self.load.addAction('&From File', self.load_system_from_file,
                            QtCore.Qt.CTRL + QtCore.Qt.Key_O)

        self.file_menu.addAction('&Save As...', self.save_file,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_S)
        self.file_menu.addAction('&Export As...', self.export_as,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.file_menu.addAction('&Close', self.close_current_tab,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_W)
        # self.file_menu.addAction('&Close All', self.close_all_tabs, QtCore.Qt.CTRL + QtCore.Qt.ShiftModifier + QtCore.Qt.Key_W)
        self.file_menu.addAction('&Quit', self.file_quit,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
        self.menuBar().addMenu(self.file_menu)

        # show
        self.show_menu = QtWidgets.QMenu('&Show', self)
        self.menuBar().addMenu(self.show_menu)

        # terminal checkbox
        self.toggle_terminal_action = QtWidgets.QAction(
            'Terminal', self.show_menu)
        self.toggle_terminal_action.setShortcut(QtCore.Qt.CTRL +
                                                QtCore.Qt.Key_T)
        self.toggle_terminal_action.setCheckable(True)
        if myConfig.get_boolean("Logging", "log_showTerminal"):
            self.toggle_terminal_action.setChecked(True)
        self.toggle_terminal_action.triggered.connect(self.toggle_terminal)
        self.show_menu.addAction(self.toggle_terminal_action)

        # vector field checkbox
        self.toggle_vectorfield_action = QtWidgets.QAction(
            '&Plot Vector Field', self.show_menu)
        self.toggle_vectorfield_action.setShortcut(QtCore.Qt.CTRL +
                                                   QtCore.Qt.Key_V)
        self.toggle_vectorfield_action.setCheckable(True)
        # if myConfig.get_boolean("Vectorfield", "vf_onByDefault"):
        #    self.toggle_vectorfield_action.setChecked(True)
        self.toggle_vectorfield_action.triggered.connect(
            self.vf_helper_function)
        self.show_menu.addAction(self.toggle_vectorfield_action)

        # streamlines checkbox
        self.toggle_streamlines_action = QtWidgets.QAction(
            '&Plot Streamlines', self.show_menu)
        self.toggle_streamlines_action.setCheckable(True)
        # if myConfig.get_boolean("Streamlines", "stream_onByDefault"):
        #    self.toggle_streamlines_action.setChecked(True)
        self.toggle_streamlines_action.triggered.connect(
            self.sl_helper_function)
        self.show_menu.addAction(self.toggle_streamlines_action)

        # equilibrium checkbox
        self.toggle_equilibrium_action = QtWidgets.QAction(
            '&Find an Equilibrium Point / Linearize', self.show_menu)
        self.toggle_equilibrium_action.setCheckable(True)
        # self.toggle_equilibrium_action.setChecked(False)
        self.toggle_equilibrium_action.triggered.connect(
            self.eq_helper_function)
        self.show_menu.addAction(self.toggle_equilibrium_action)
        #self.show_menu.addAction('&Find an Equilibrium Point', self.myGraph.toggleEP)

        # linearize checkbox
        # self.linearize_action = QtWidgets.QAction('&Linearize', self.show_menu)
        # self.linearize_action.triggered.connect(self.linearize_helper_function)
        # self.show_menu.addAction(self.linearize_action)

        # nullclines checkbox
        self.toggle_nullclines_action = QtWidgets.QAction(
            'Nullclines', self.show_menu)
        self.toggle_nullclines_action.setShortcut(QtCore.Qt.CTRL +
                                                  QtCore.Qt.Key_N)
        self.toggle_nullclines_action.setCheckable(True)
        # if system exists: read toggle-value
        # if not: read from config
        # TODO: new systems tab chosen -> check/uncheck toggle!
        # if self.systems == []:
        # read current systems tab:
        # if myConfig.get_boolean("Nullclines", "nc_onByDefault"):
        # self.toggle_nullclines_action.setChecked(True)
        self.toggle_nullclines_action.triggered.connect(self.toggle_nullclines)
        self.show_menu.addAction(self.toggle_nullclines_action)

        # self.show_menu.addAction('&Calculate Nullclines (symbolic)', myNullclines.print_symbolic_nullclines)

        # help
        self.help_menu = QtWidgets.QMenu('&Help', self)
        self.menuBar().addMenu(self.help_menu)
        self.help_menu.addAction('&About', self.about)

        # initializing with default values ------------------------------------------------------
        self.init()
        # self.build_settings_tab()

        # from now on, plot only log messages as defined in config file.
        # for that, call initialize function in myLogger
        myLogger.initialize()
예제 #23
0
파일: __init__.py 프로젝트: Joel-U/sparkle
import sip
sip.setdestroyonexit(0)
예제 #24
0
import sys
import math

from PyQt4 import QtCore, QtGui, QtOpenGL

try:
    from OpenGL.GL import *
except ImportError:
    app = QtGui.QApplication(sys.argv)
    QtGui.QMessageBox.critical(
        None, "OpenGL grabber",
        "PyOpenGL must be installed to run this example.")
    sys.exit(1)

from sip import setdestroyonexit
setdestroyonexit(False)


class GLWidget(QtOpenGL.QGLWidget):
    xRotationChanged = QtCore.pyqtSignal(int)
    yRotationChanged = QtCore.pyqtSignal(int)
    zRotationChanged = QtCore.pyqtSignal(int)

    def __init__(self, parent=None):
        super(GLWidget, self).__init__(parent)

        self.gear1 = 0
        self.gear2 = 0
        self.gear3 = 0
        self.xRot = 0
        self.yRot = 0
예제 #25
0
		self.df.set_value(row, col, value)
		print self.df.set_value(row, col, value)
		print "AAA"


if __name__ == "__main__":
	import sys
	app = QtGui.QApplication(sys.argv)
	splash_pix = QPixmap(u"splash_loading.png")
	splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
	splash.setMask(splash_pix.mask())
	splash.show()
	app.processEvents()

	#pixmap = QtGui.QPixmap(u"splash_loading.png")
	#splash = QtGui.QSplashScreen(pixmap)
	#label = QtGui.QLabel(splash)
	#label.setText("<br>       <br>Foxreal")
	#label.setAlignment(QtCore.Qt.AlignRight)
	#splash.show()
	#QtCore.QCoreApplication.processEvents()
	#time.sleep(2)
	MainWindow = MainWindow()
	#splash.finish(MainWindow.getWidget(splash))

	MainWindow.show()
	splash.finish(MainWindow)
	sip.setdestroyonexit(app.exec_())
    

예제 #26
0
파일: base.py 프로젝트: nikicc/orange3
    LearnerClassification, ModelClassification
)
from Orange.data import Table, Domain, DiscreteVariable, ContinuousVariable
from Orange.modelling import Fitter
from Orange.preprocess import RemoveNaNColumns, Randomize
from Orange.preprocess.preprocess import PreprocessorList
from Orange.regression.base_regression import (
    LearnerRegression, ModelRegression
)
from Orange.widgets.utils.annotated_data import (
    ANNOTATED_DATA_FEATURE_NAME, ANNOTATED_DATA_SIGNAL_NAME
)
from Orange.widgets.widget import OWWidget
from Orange.widgets.utils.owlearnerwidget import OWBaseLearner

sip.setdestroyonexit(False)

app = None

DEFAULT_TIMEOUT = 5000

# pylint: disable=invalid-name
T = TypeVar("T")


class DummySignalManager:
    def __init__(self):
        self.outputs = {}

    def send(self, widget, signal_name, value, id):
        if not isinstance(signal_name, str):
예제 #27
0
파일: main.py 프로젝트: SodaCookie/rpeg
def init():
    app = QtWidgets.QApplication(sys.argv)
    form = Editor()
    form.show()
    sip.setdestroyonexit(False) # Fixes a crash bug
    sys.exit(app.exec_())
예제 #28
0
import sys
import math

from PyQt4 import QtCore, QtGui, QtOpenGL


try:
    from OpenGL.GL import *
except ImportError:
    app = QtGui.QApplication(sys.argv)
    QtGui.QMessageBox.critical(None, "OpenGL grabber",
            "PyOpenGL must be installed to run this example.")
    sys.exit(1)

from sip import setdestroyonexit
setdestroyonexit(False)

class GLWidget(QtOpenGL.QGLWidget):
    xRotationChanged = QtCore.pyqtSignal(int)
    yRotationChanged = QtCore.pyqtSignal(int)
    zRotationChanged = QtCore.pyqtSignal(int)

    def __init__(self, parent=None):
        super(GLWidget, self).__init__(parent)

        self.gear1 = 0
        self.gear2 = 0
        self.gear3 = 0
        self.gear4 = 0
        self.xRot = 0
        self.yRot = 0
 def closeEvent(self, event):
     #global COUNT_COMMANDS
     self.COUNT_COMMANDS = 0
     #self.DataCollector.terminate()
     sip.setdestroyonexit(False)
     sys.exit()
 def close_application(self):
     #global COUNT_COMMANDS
     self.COUNT_COMMANDS = 0
     #self.DataCollector.terminate()
     sip.setdestroyonexit(False)
     sys.exit()
예제 #31
0
파일: __main__.py 프로젝트: akehrer/fiddle
def main():
    sip.setdestroyonexit(False)  # fix for occasional crashes on exit
    app = App(sys.argv)
    translator = QtCore.QTranslator()
    translator.load(QtCore.QLocale.system().name() + '.qm', 'locale')
    app.exec_()
예제 #32
0
import utool as ut
ut.noinject(__name__, '[guitool.__PYQT__]')

try:
    import sip
    # http://stackoverflow.com/questions/21217399/pyqt4-qtcore-qvariant-object-instead-of-a-string
    sip.setapi('QVariant', 2)
    sip.setapi('QString', 2)
    sip.setapi('QTextStream', 2)
    sip.setapi('QTime', 2)
    sip.setapi('QUrl', 2)
    sip.setapi('QDate', 2)
    sip.setapi('QDateTime', 2)
    if hasattr(sip, 'setdestroyonexit'):
        sip.setdestroyonexit(False)  # This prevents a crash on windows
except ValueError as ex:
    print('Warning: Value Error: %s' % str(ex))
    pass


from PyQt4 import *
"""
import __PYQT__
from __PYQT__ import QtCore
from __PYQT__ import QtGui
from __PYQT__ import QtTest
from __PYQT__.QtCore import Qt
from __PYQT__.QtGui import QSizePolicy
"""
from . import QtCore
예제 #33
0
def init():
    app = QtWidgets.QApplication(sys.argv)
    form = Editor()
    form.show()
    sip.setdestroyonexit(False)  # Fixes a crash bug
    sys.exit(app.exec_())
예제 #34
0
파일: main.py 프로젝트: klim-/pyplane
    def __init__(self):
        # superclass constructor
        PyplaneMainWindow.__init__(self)
        QtCore.pyqtRemoveInputHook()

        # If set to True the app crashes under MS Windows if it is immediately closed after startup without any
        # further actions
        sip.setdestroyonexit(False)
        
        # Set Version-number
        self.setWindowTitle("PyPlane " + self.__PYPLANE_VERSION)

        # check config file if shown by default
        self.terminal_toggle = myConfig.get_boolean("Logging", "showTerminal")
        self.update_terminal()
        
        #~ # connect buttons ------------------------------------------------------
        #~ # connect buttons: system
        self.clearButton.clicked.connect(self.clear_trajectories)
        self.submitButton.clicked.connect(self.submit)

        #~ # connect buttons: additional function
        self.FctPlotButton.clicked.connect(self.add_function)
        self.FctClearButton.clicked.connect(self.remove_functions)

        # file menu ------------------------------------------------------
        # file
        self.file_menu = QtGui.QMenu('&System', self)

        self.load = QtGui.QMenu('&Open', self)
        self.file_menu.addMenu(self.load)
        self.load.addAction('&Recent', self.load_tmp_system)
        self.load.addAction('&From File', self.load_system_from_file,
                            QtCore.Qt.CTRL + QtCore.Qt.Key_O)

        self.file_menu.addAction('&Save As...', self.save_file,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_S)
        self.file_menu.addAction('&Export As...', self.export_as, QtCore.Qt.CTRL + QtCore.Qt.Key_E)
        self.file_menu.addAction('&Close', self.close_current_tab, QtCore.Qt.CTRL + QtCore.Qt.Key_W)
        #~ self.file_menu.addAction('&Close All', self.close_all_tabs, QtCore.Qt.CTRL + QtCore.Qt.ShiftModifier + QtCore.Qt.Key_W)
        self.file_menu.addAction('&Quit', self.file_quit, QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
        self.menuBar().addMenu(self.file_menu)

        # show
        self.show_menu = QtGui.QMenu('&Show', self)
        self.menuBar().addMenu(self.show_menu)

        # terminal checkbox
        self.toggle_terminal_action = QtGui.QAction('Terminal', self.show_menu)
        self.toggle_terminal_action.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_T)
        self.toggle_terminal_action.setCheckable(True)
        if myConfig.get_boolean("Logging", "showTerminal"):
            self.toggle_terminal_action.setChecked(True)
        self.toggle_terminal_action.triggered.connect(self.toggle_terminal)
        self.show_menu.addAction(self.toggle_terminal_action)

        # vector field checkbox
        self.toggle_vectorfield_action = QtGui.QAction('&Plot Vector Field', self.show_menu)
        self.toggle_vectorfield_action.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_V)
        self.toggle_vectorfield_action.setCheckable(True)
        #~ if myConfig.get_boolean("Vectorfield", "vf_onByDefault"):
            #~ self.toggle_vectorfield_action.setChecked(True)
        self.toggle_vectorfield_action.triggered.connect(self.vf_helper_function)
        self.show_menu.addAction(self.toggle_vectorfield_action)

        # streamlines checkbox
        self.toggle_streamlines_action = QtGui.QAction('&Plot Streamlines', self.show_menu)
        self.toggle_streamlines_action.setCheckable(True)
        #~ if myConfig.get_boolean("Streamlines", "stream_onByDefault"):
            #~ self.toggle_streamlines_action.setChecked(True)
        self.toggle_streamlines_action.triggered.connect(self.sl_helper_function)
        self.show_menu.addAction(self.toggle_streamlines_action)

        # equilibrium checkbox
        self.toggle_equilibrium_action = QtGui.QAction('&Find an Equilibrium Point / Linearize', self.show_menu)
        self.toggle_equilibrium_action.setCheckable(True)
        #~ self.toggle_equilibrium_action.setChecked(False)
        self.toggle_equilibrium_action.triggered.connect(self.eq_helper_function)
        self.show_menu.addAction(self.toggle_equilibrium_action)
        #self.show_menu.addAction('&Find an Equilibrium Point', self.myGraph.toggleEP)

        # linearize checkbox
        #~ self.linearize_action = QtGui.QAction('&Linearize', self.show_menu)
        #~ self.linearize_action.triggered.connect(self.linearize_helper_function)
        #~ self.show_menu.addAction(self.linearize_action)

        # nullclines checkbox
        self.toggle_nullclines_action = QtGui.QAction('Nullclines', self.show_menu)
        self.toggle_nullclines_action.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_N)
        self.toggle_nullclines_action.setCheckable(True)
        # if system exists: read toggle-value
        # if not: read from config
        # TODO: new systems tab chosen -> check/uncheck toggle!
        #~ if self.systems == []:
            # read current systems tab:        
        #~ if myConfig.get_boolean("Nullclines", "nc_onByDefault"):
            #~ self.toggle_nullclines_action.setChecked(True)
        self.toggle_nullclines_action.triggered.connect(self.toggle_nullclines)
        self.show_menu.addAction(self.toggle_nullclines_action)

        #~ self.show_menu.addAction('&Calculate Nullclines (symbolic)', myNullclines.print_symbolic_nullclines)

        # help
        self.help_menu = QtGui.QMenu('&Help', self)
        self.menuBar().addMenu(self.help_menu)
        self.help_menu.addAction('&About', self.about)

        # initializing with default values ------------------------------------------------------
        self.init()
        #~ self.build_settings_tab()

        # from now on, plot only log messages as defined in config file.
        # for that, call initialize function in myLogger
        myLogger.initialize()      
예제 #35
0
import utool as ut
ut.noinject(__name__, '[guitool.__PYQT__]')

try:
    import sip
    # http://stackoverflow.com/questions/21217399/pyqt4-qtcore-qvariant-object-instead-of-a-string
    sip.setapi('QVariant', 2)
    sip.setapi('QString', 2)
    sip.setapi('QTextStream', 2)
    sip.setapi('QTime', 2)
    sip.setapi('QUrl', 2)
    sip.setapi('QDate', 2)
    sip.setapi('QDateTime', 2)
    if hasattr(sip, 'setdestroyonexit'):
        sip.setdestroyonexit(False)  # This prevents a crash on windows
except ValueError as ex:
    print('Warning: Value Error: %s' % str(ex))
    pass

from PyQt4 import *
"""
import __PYQT__
from __PYQT__ import QtCore
from __PYQT__ import QtGui
from __PYQT__ import QtTest
from __PYQT__.QtCore import Qt
from __PYQT__.QtGui import QSizePolicy
"""
from . import QtCore
from . import QtGui
예제 #36
0
        row = index.row()
        col = index.col()
        value = 0
        self.df.set_value(row, col, value)
        print self.df.set_value(row, col, value)
        print "AAA"

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    splash_pix = QPixmap(u"splash_loading.png")
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    #pixmap = QtGui.QPixmap(u"splash_loading.png")
    #splash = QtGui.QSplashScreen(pixmap)
    #label = QtGui.QLabel(splash)
    #label.setText("<br>       <br>Foxreal")
    #label.setAlignment(QtCore.Qt.AlignRight)
    #splash.show()
    #QtCore.QCoreApplication.processEvents()
    #time.sleep(2)
    MainWindow = MainWindow()
    #splash.finish(MainWindow.getWidget(splash))

    MainWindow.show()
    splash.finish(MainWindow)
    sip.setdestroyonexit(app.exec_())
예제 #37
0
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Erik Hvatum <*****@*****.**>

import sip
sip.setdestroyonexit(True)

import atexit
from PyQt5 import Qt
import sys
from . import async_texture
from .layer import Layer
from .layer_stack import LayerList, LayerStack
from .point_list_picker import PointListPicker
from .qwidgets.flipbook import Flipbook
from .qwidgets.fps_display import FPSDisplay
from .qwidgets.layer_table import InvertingProxyModel, LayerTableModel, LayerTableView
from .qwidgets.layer_stack_painter import LayerStackPainter
from .qwidgets.point_list_picker_table import PointListPickerTable
from .qgraphicsscenes.general_scene import GeneralScene
from .qgraphicsviews.general_view import GeneralView
예제 #38
0
from __future__ import unicode_literals

from collections import namedtuple

try:
    from PyQt5 import QtCore
    using_pyqt5 = True
except ImportError:
    using_pyqt5 = False

if using_pyqt5:
    from PyQt5 import QtGui, QtWebKit, QtWebKitWidgets, QtWidgets
    from PyQt5.QtCore import Qt
    from PyQt5.QtNetwork import QNetworkProxy
    import sip
    sip.setdestroyonexit(True)
else:
    import sip
    sip.setapi('QString', 2)
    sip.setapi('QVariant', 2)
    from PyQt4 import QtCore, QtGui, QtWebKit
    QtWidgets = QtGui
    QtWebKitWidgets = QtWebKit
    from PyQt4.QtCore import Qt
    from PyQt4.QtNetwork import QNetworkProxy
import six

from photini.spelling import SpellingHighlighter

qt_version_info = namedtuple(
    'qt_version_info', ('major', 'minor', 'micro'))._make(
예제 #39
0
파일: main.py 프로젝트: al3xc1985/ssi
def main():
    sip.setdestroyonexit(False)
    wnd.show()
    sys.exit(app.exec())
예제 #40
0
import unittest
from contextlib import contextmanager
from unittest.mock import Mock, patch
from typing import List, Optional, TypeVar, Type

import sip

from AnyQt.QtCore import Qt
from AnyQt.QtTest import QTest, QSignalSpy
from AnyQt.QtWidgets import (QApplication, QComboBox, QSpinBox, QDoubleSpinBox,
                             QSlider)

from orangewidget.report.owreport import OWReport
from orangewidget.widget import OWBaseWidget

sip.setdestroyonexit(False)

app = None

DEFAULT_TIMEOUT = 5000

# pylint: disable=invalid-name
T = TypeVar("T")


@contextmanager
def named_file(content, encoding=None, suffix=''):
    file = tempfile.NamedTemporaryFile("wt",
                                       delete=False,
                                       encoding=encoding,
                                       suffix=suffix)
예제 #41
0
    def get(self, locality, checkin_date, checkout_date):
        global checkIn
        global checkOut
        global destination
        global lat
        global log
        global state
        global qt
        global c
        destination = locality

        checkin_date = datetime.strptime(checkin_date, "%Y-%m-%d")
        checkout_date = datetime.strptime(checkout_date, "%Y-%m-%d")

        checkIn = datetime.strftime(checkin_date, "%Y-%m-%d")
        checkOut = datetime.strftime(checkout_date, "%Y-%m-%d")

        today = datetime.now()

        if today < datetime.strptime(
                checkIn, "%Y-%m-%d") and datetime.strptime(
                    checkIn, "%Y-%m-%d") < datetime.strptime(
                        checkOut, "%Y-%m-%d"):
            urls = list()
            try:
                results = Geocoder.geocode(locality)
                print(results)
                r = results[0].coordinates, results.state
                print(r)
                lat = r[0][0]
                log = r[0][1]
                state = r[1]
            except pygeolib.GeocoderError:
                return {
                    "message":
                    "invalid location, where are you going? try again!"
                }
            except:
                time.sleep(2)
                return {
                    "message":
                    "hushhh! I need some rest can i come with you to {}".
                    format(locality)
                }

            checkIn = checkin_date.strftime("%Y-%m-%d")
            checkOut = checkout_date.strftime("%Y-%m-%d")
            for page in range(0, 1):
                url = "https://www.trivago.in/?aDateRange[arr]=" + checkIn + "&aDateRange[dep]=" + checkOut + "&aPriceRange[from]=0&aPriceRange[to]=0&iPathId=8&aGeoCode[lat]=" + str(
                    lat) + "&aGeoCode[lng]=" + str(log) + "&iOffset=" + str(
                        page)
                urls.append(url)

            #app=King.main()
            global app
            app = QtGui.QApplication.instance()
            if app is None:
                app = QtGui.QApplication(sys.argv)
            r = Render(urls, app, cb=King.scrape)

            sip.setdestroyonexit(False)

            print(j)

            return {"message": j}

        #checking whether the entered date is already passed
        elif today > datetime.strptime(
                checkIn, "%Y-%m-%d") or today > datetime.strptime(
                    checkOut, "%Y-%m-%d"):
            return {
                "message":
                "Invalid Checkin date: Please enter a valid checkin and checkout dates,entered date is already passed"
            }

        elif datetime.strptime(checkIn, "%Y-%m-%d") > datetime.strptime(
                checkOut, "%Y-%m-%d"):
            return {
                "message":
                "Invalid Checkin date: CheckIn date must be less than checkOut date"
            }