Esempio n. 1
0
    def start_compute(self,
                      name,
                      func,
                      param=None,
                      suffix=None,
                      interactive=True):
        self.QProxy.emit(SIGNAL("computing"))
        if interactive and param is not None:
            if interactive == 'text' and not param.text_edit():
                return
            elif not param.edit():
                return
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        try:
            processing = name
            if suffix is not None:
                processing += " | " + suffix(param)

            result = Measurement()
            result.copy_param(self.measurement)
            result.set_rawdata(self.apply_func(func, param))
            result['processing'] += processing + "\n"
        except Exception, msg:
            import traceback
            traceback.print_exc()
            QMessageBox.critical(
                None, APP_NAME,
                _(u"An error occured:") + "\n%s" % unicode(msg))
            raise ComputationError, msg
Esempio n. 2
0
def run_testlauncher(package):
    """Run test launcher"""
    from guidata.qt.QtGui import QApplication
    app = QApplication([])
    win = TestLauncherWindow(package)
    win.show()
    app.exec_()
Esempio n. 3
0
def run_testlauncher(package):
    """Run test launcher"""
    from guidata.qt.QtGui import QApplication
    app = QApplication([])
    win = TestLauncherWindow(package)
    win.show()
    app.exec_()
Esempio n. 4
0
def show_std_icons():
    """
    Show all standard Icons
    """
    app = QApplication(sys.argv)
    dialog = ShowStdIcons(None)
    dialog.show()
    sys.exit(app.exec_())
Esempio n. 5
0
def show_std_icons():
    """
    Show all standard Icons
    """
    app = QApplication(sys.argv)
    dialog = ShowStdIcons(None)
    dialog.show()
    sys.exit(app.exec_())
Esempio n. 6
0
def test():
    from guidata.qt.QtGui import QApplication

    app = QApplication([])
    win = TestWindow()
    win.setup_window()

    win.show()
    app.exec_()
Esempio n. 7
0
def qapplication():
    """
    Return QApplication instance
    Creates it if it doesn't already exist
    """
    from guidata.qt.QtGui import QApplication
    app = QApplication.instance()
    if not app:
        app = QApplication([])
    install_translator(app)
    return app
Esempio n. 8
0
File: gui.py Progetto: cbig/zupport
def main():
    
    # Init the Qt basics
    from guidata.qt.QtGui import QApplication
    app = QApplication(sys.argv)
    app.setApplicationName("Zupport")
    app.setApplicationVersion(__version__)
    app.setOrganizationName("HU")
    app.setOrganizationDomain("MRG")
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())
Esempio n. 9
0
def test():
    """Testing this simple Qt/guiqwt example"""
    from guidata.qt.QtGui import QApplication
    import numpy as np
    import scipy.signal as sps, scipy.ndimage as spi

    app = QApplication([])
    win = TestWindow()

    x = np.linspace(-10, 10, 500)
    y = np.random.rand(len(x)) + 5 * np.sin(2 * x**2) / x
    win.add_plot(x, y, lambda x: spi.gaussian_filter1d(x, 1.), "Gaussian")
    win.add_plot(x, y, sps.wiener, "Wiener")

    win.show()
    app.exec_()
Esempio n. 10
0
def test():
    """Testing this simple Qt/guiqwt example"""
    from guidata.qt.QtGui import QApplication
    import numpy as np
    import scipy.signal as sps, scipy.ndimage as spi
    
    app = QApplication([])
    win = TestWindow()
    
    x = np.linspace(-10, 10, 500)
    y = np.random.rand(len(x))+5*np.sin(2*x**2)/x
    win.add_plot(x, y, lambda x: spi.gaussian_filter1d(x, 1.), "Gaussian")
    win.add_plot(x, y, sps.wiener, "Wiener")
    
    win.show()
    app.exec_()
Esempio n. 11
0
 def copy_to_clipboard(self):
     """Copy widget's window to clipboard"""
     clipboard = QApplication.clipboard()
     if PYQT5:
         pixmap = self.grab()
     else:
         pixmap = QPixmap.grabWidget(self)
     clipboard.setPixmap(pixmap)
Esempio n. 12
0
 def copy_to_clipboard(self):
     """Copy widget's window to clipboard"""
     clipboard = QApplication.clipboard()
     if PYQT5:
         pixmap = self.grab()
     else:
         pixmap = QPixmap.grabWidget(self)
     clipboard.setPixmap(pixmap)
Esempio n. 13
0
 def start(self, close=False):
     # Create plot window
     win = self.WIN_CLASS(toolbar=True, wintitle=self.name)
     win.show()
     QApplication.processEvents()
     plot = win.get_plot()
     
     # Create item (ignore this step in benchmark result!)
     self.make_item()
     
     # Benchmarking
     t0 = time.time()
     self.add_to_plot(plot)
     print(self.name+':')
     print("    N  = %d" % self.nsamples)
     plot.replot()  # Force replot
     print("    dt = %d ms" % ((time.time()-t0)*1e3))
     if close:
         win.close()
Esempio n. 14
0
    def start(self, close=False):
        # Create plot window
        win = self.WIN_CLASS(toolbar=True, wintitle=self.name)
        win.show()
        QApplication.processEvents()
        plot = win.get_plot()

        # Create item (ignore this step in benchmark result!)
        self.make_item()

        # Benchmarking
        t0 = time.time()
        self.add_to_plot(plot)
        print(self.name + ':')
        print("    N  = %d" % self.nsamples)
        plot.replot()  # Force replot
        print("    dt = %d ms" % ((time.time() - t0) * 1e3))
        if close:
            win.close()
Esempio n. 15
0
def qapplication():
    """
    Return QApplication instance
    Creates it if it doesn't already exist
    """
    from guidata.qt.QtGui import QApplication
    app = QApplication.instance()
    if not app:
        app = QApplication([])
    install_translator(app)
    return app
Esempio n. 16
0
            self.scp.record_length = int(self.recordLen.text())
            self.xAxeChanged.emit(
                0, 1 / self.scp.sample_frequency * self.scp.record_length)

    def _setHystereses(self):
        with QMutexLocker(self.mutex):
            self.scp.hystereses = float(self.hystereses.text())

    def _check_state(self, *args, **kwargs):
        '''https://snorfalorpagus.net/blog/2014/08/09/validating-user-input-in-pyqt4-using-qvalidator/'''
        sender = self.sender()
        validator = sender.validator()
        state = validator.validate(sender.text(), 0)[0]
        if state == QValidator.Acceptable:
            color = '#FFFFFF'  # green
        elif state == QValidator.Intermediate:
            color = '#fff79a'  # yellow
        else:
            color = '#f6989d'  # red
        sender.setStyleSheet('QLineEdit { background-color: %s }' % color)


if __name__ == '__main__':
    from guidata.qt.QtGui import QApplication
    import sys
    app = QApplication(sys.argv)
    #test = MyApp()
    test = TiePieUi(None)
    test.show()
    app.exec_()
Esempio n. 17
0
"""
Testing guiqwt QtDesigner plugins

These plugins provide CurveWidget and ImageWidget objects 
embedding in GUI layouts directly from QtDesigner.
"""

SHOW = True # Show test in GUI-based test launcher

import sys, os.path as osp

from guidata.qt.QtGui import QApplication
from guiqwt.qtdesigner import loadui
from guiqwt.builder import make

FormClass = loadui( osp.splitext(__file__)[0]+'.ui' )

class TestWindow(FormClass):
    def __init__(self, image_data):
        super(TestWindow, self).__init__()
        plot = self.imagewidget.plot
        plot.add_item(make.image(image_data))
        self.setWindowTitle("QtDesigner plugins example")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    from guiqwt.tests.image import compute_image
    form = TestWindow( compute_image() )
    form.show()
    sys.exit(app.exec_())
Esempio n. 18
0
 def xcsw_is_visible(self, state):
     if state:
         QApplication.processEvents()
         self.adjust_ycsw_height()
     else:
         self.adjust_ycsw_height(0)
Esempio n. 19
0
 def adjust_ycsw_height(self, height=None):
     if height is None:
         height = self.xcsw.height() - self.ycsw.toolbar.height()
     self.ycsw.adjust_height(height)
     if height:
         QApplication.processEvents()
Esempio n. 20
0
 def child_title(self, item):
     """Return data item title combined with QApplication title"""
     app_name = QApplication.applicationName()
     if not app_name:
         app_name = to_text_string(self.title())
     return "%s - %s" % ( app_name, item.label() )
Esempio n. 21
0
def main():
    
    # Init the Qt basics
    from guidata.qt.QtGui import QApplication
    app = QApplication(sys.argv)
    app.setApplicationName("Zupport")
    app.setApplicationVersion(__version__)
    app.setOrganizationName("HU")
    app.setOrganizationDomain("MRG")
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())
Esempio n. 22
0
 def child_title(self, item):
     """Return data item title combined with QApplication title"""
     app_name = QApplication.applicationName()
     if not app_name:
         app_name = self.instance.get_title()
     return "%s - %s" % ( app_name, item.label() )
Esempio n. 23
0
 def child_title(self, item):
     """Return data item title combined with QApplication title"""
     app_name = QApplication.applicationName()
     if not app_name:
         app_name = self.instance.get_title()
     return "%s - %s" % ( app_name, item.label() )
Esempio n. 24
0
    except Exception:
        return "Unknown"

def is_service_running(status = None):
    if status == None:
        status = get_service_status()
    return status == win32service.SERVICE_RUNNING

def is_service_pending(status = None):
    if status == None:
        status = get_service_status()
    return status in [win32service.SERVICE_STOP_PENDING, win32service.SERVICE_START_PENDING]

def is_service_stopped(status = None):
    if status == None:
        status = get_service_status()
    return status == win32service.SERVICE_STOPPED

def warning_popup(message, parent=None):
    QMessageBox.warning(parent, 'Message', message, QMessageBox.Ok)

def info_popup(message, parent=None):
    QMessageBox.information(parent, 'Message', message, QMessageBox.Ok)


if __name__ == '__main__':
    from guidata.qt.QtGui import QApplication
    app = QApplication([])
    win = MainWindow()
    win.show()
    app.exec_()
Esempio n. 25
0
SHOW = True  # Show test in GUI-based test launcher

from guidata.qt.QtGui import QFrame, QGridLayout
from guidata.qt.QtCore import Qt
from guidata.qtwidgets import RotatedLabel


class Frame(QFrame):
    def __init__(self, parent=None):
        QFrame.__init__(self, parent)
        layout = QGridLayout()
        self.setLayout(layout)
        angle = 0
        for row in range(7):
            for column in range(7):
                layout.addWidget(
                    RotatedLabel("Label %03d°" % angle,
                                 angle=angle,
                                 color=Qt.blue,
                                 bold=True), row, column, Qt.AlignCenter)
                angle += 10


if __name__ == '__main__':
    from guidata.qt.QtGui import QApplication
    import sys
    app = QApplication([])
    frame = Frame()
    frame.show()
    sys.exit(app.exec_())
Esempio n. 26
0
        
    def update_remote_params(self):
        utils.Log("sequence parameters updated")
        self.process()
      
    def update_holder_params(self):
        utils.Log("focus parameter updated")
        self.process()
        
        
        
    def process(self):
        if self.db is None:
            self.db = SqliteDB.DBReader()
            self.db.ProductionNo = self.gb_dhm.dataset.MODB
            self.db.ParamFromChoice()
        
#        if self.stackDistance is None:
#            self.stackDistance = Tracking_process.stackDistance.from_dataset(
#            self.db, self.gb_dhm.dataset, None, None, None, None)

# main to run the application
if __name__ == '__main__':
    # create QApplication
    from guidata.qt.QtGui import QApplication
    app = QApplication.instance()
    if not app:
        app = QApplication(sys.argv)
    
    window = MainWindow()
    window.show()
Esempio n. 27
0
		self.msg_type_dict = {
			'I': lambda: self.information_box.get() == 1,
			'C': lambda: self.convention_box.get() == 1,
			'R': lambda: self.refactor_box.get() == 1,
			'E': lambda: self.error_box.get() == 1,
			'W': lambda: self.warning_box.get() == 1,
			'F': lambda: self.fatal_box.get() == 1
		}

	def setup_msg_buttons(self):
		msg_buttons = qt.QtGui.QButtonGroup()
		
		self.information_button = qt.QtGui.QRadioButton('information')
		
		self.information_box = qt.QtGui.QCheckBox('information')
		
#QTextList
#QSessionManager
#QRadioButton
#QListWidgetItem
#QListView
#QListWidget
#QGroupBox
#QButtonGroup


if __name__ == '__main__':
	from guidata.qt.QtGui import QApplication
	app = QApplication(sys.argv)
	window = Window()
	window.show()
Esempio n. 28
0
        glob_para = ode_solver.init_glob_para(HC)
        pv_model = ode_solver.compute_ode(Rp, Ra, Rin, Ca, Cv, Vd, Emax, Emin,
                                          t, start_v, start_pa, start_pv)
        Plv_vector = [
            ode_solver.Plv(v, Vd, Emax, Emin, x)
            for x, v in zip(t, pv_model[0])
        ]
        #print(pv_model[0])

        col = ["b", "r", "k", "c", "m"]
        mypen = PG.mkPen(col[self.number_plots], width=3)

        self.pw1.plot(t, np.array(pv_model[0]), pen=mypen)
        self.pw2.plot(t, np.array(Plv_vector), pen=mypen)
        self.pw3.plot(np.array(pv_model[0]), np.array(Plv_vector), pen=mypen)

        if self.number_plots < 4:
            self.number_plots += 1
        else:
            self.number_plots = 0

        print('PV loop computed')


if __name__ == '__main__':
    from guidata.qt.QtGui import QApplication
    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())
Esempio n. 29
0
                processing += " | " + suffix(param)

            result = Measurement()
            result.copy_param(self.measurement)
            result.set_rawdata(self.apply_func(func, param))
            result['processing'] += processing + "\n"
        except Exception, msg:
            import traceback
            traceback.print_exc()
            QMessageBox.critical(
                None, APP_NAME,
                _(u"An error occured:") + "\n%s" % unicode(msg))
            raise ComputationError, msg
        finally:
            self.QProxy.emit(SIGNAL("computing finished"))
            QApplication.restoreOverrideCursor()
        return self.__baseclass__(result)

    def end_compute(self, result):
        result.update_style()
        self.QProxy.emit(SIGNAL("new_item_computed"), result)
        return result

    def compute(self, name, func, param=None, suffix=None, interactive=True):
        try:
            result = self.start_compute(name, func, param, suffix, interactive)
            return self.end_compute(result)
        except ComputationError, msg:
            print _("Computation error: %s") % msg
            return
Esempio n. 30
0
    except Exception as e:
        msg = "Unable to write pidfile: %s %s" % (pidfile, str(e))
        log.exception(msg)
        sys.stderr.write(msg + "\n")
        sys.exit(1)


if __name__ == '__main__':
    if Platform.is_windows():
        # Let's kill any other running instance of our GUI/SystemTray before starting a new one.
        kill_old_process()
        if len(sys.argv) > 1 and "-stop" in sys.argv:
            # just return.  The kill_old_process() should have terminated the process,
            # and now we're done.
            sys.exit(0)

    app = QApplication([])
    if Platform.is_mac():
        add_image_path(osp.join(os.getcwd(), 'images'))
        # add datadog-agent in PATH
        os.environ['PATH'] = "{0}:{1}".format('/opt/datadog-agent/bin/',
                                              os.environ['PATH'])
        win = SystemTray() if len(sys.argv) < 2 else MainWindow()
    else:
        win = MainWindow()
    # Let's start the agent if he's not already started
    if agent_status() not in [AGENT_RUNNING, AGENT_START_PENDING]:
        agent_manager('start')
    win.show()
    app.exec_()
Esempio n. 31
0
 def adjust_ycsw_height(self, height=None):
     if height is None:
         height = self.xcsw.height()-self.ycsw.toolbar.height()
     self.ycsw.adjust_height(height)
     if height:
         QApplication.processEvents()
Esempio n. 32
0
 def child_title(self, item):
     """Return data item title combined with QApplication title"""
     app_name = QApplication.applicationName()
     if not app_name:
         app_name = to_text_string(self.title())
     return "%s - %s" % ( app_name, item.label() )
Esempio n. 33
0
 def xcsw_is_visible(self, state):
     if state:
         QApplication.processEvents()
         self.adjust_ycsw_height()
     else:
         self.adjust_ycsw_height(0)
Esempio n. 34
0
        self.process()

    def update_remote_params(self):
        utils.Log("sequence parameters updated")
        self.process()

    def update_holder_params(self):
        utils.Log("focus parameter updated")
        self.process()

    def process(self):
        if self.db is None:
            self.db = SqliteDB.DBReader()
            self.db.ProductionNo = self.gb_dhm.dataset.MODB
            self.db.ParamFromChoice()


#        if self.stackDistance is None:
#            self.stackDistance = Tracking_process.stackDistance.from_dataset(
#            self.db, self.gb_dhm.dataset, None, None, None, None)

# main to run the application
if __name__ == '__main__':
    # create QApplication
    from guidata.qt.QtGui import QApplication
    app = QApplication.instance()
    if not app:
        app = QApplication(sys.argv)

    window = MainWindow()
    window.show()
Esempio n. 35
0
 def copy_to_clipboard(self):
     """Copy widget's window to clipboard"""
     clipboard = QApplication.clipboard()
     clipboard.setPixmap(QPixmap.grabWidget(self))