예제 #1
0
    def test1(self):
        class FT(QToolBar):
            def paintEvent(self, e):
                pass

        w = QMainWindow()
        ftt, ftb = FT(), FT()
        ftt.setFixedHeight(15)
        ftb.setFixedHeight(15)

        w.addToolBar(Qt.TopToolBarArea, ftt)
        w.addToolBar(Qt.BottomToolBarArea, ftb)

        f = dropshadow.DropShadowFrame()
        te = QTextEdit()
        c = QWidget()
        c.setLayout(QVBoxLayout())
        c.layout().setContentsMargins(20, 0, 20, 0)
        c.layout().addWidget(te)
        w.setCentralWidget(c)
        f.setWidget(te)
        f.radius = 15
        f.color = QColor(Qt.blue)
        w.show()

        self.singleShot(3000, lambda: f.setColor(Qt.red))
        self.singleShot(4000, lambda: f.setRadius(30))
        self.singleShot(5000, lambda: f.setRadius(40))

        self.app.exec_()
예제 #2
0
def main():
    app = QApplication(sys.argv)

    window = QMainWindow()
    splitter = QSplitter(window)
    window.setCentralWidget(splitter)
    left_view = MouseDevicesView(window)
    left_view.checkedDevicesChanged.connect(partial(show, 'left:'))
    right_view = MouseDevicesView(window)
    right_view.checkedDevicesChanged.connect(partial(show, 'right:'))
    splitter.addWidget(left_view)
    splitter.addWidget(right_view)

    def _move_checked_state(source, dest):
        checked = source.property('checkedDevices').toPyObject()
        dest.setProperty('checkedDevices', checked)

    toolbar = window.addToolBar('Actions')
    move_selection_left = QAction(QIcon.fromTheme('arrow-left'),
                                  'Moved checked state left',
                                  window,
                                  triggered=partial(_move_checked_state,
                                                    right_view, left_view))
    move_selection_right = QAction(QIcon.fromTheme('arrow-right'),
                                   'Moved checked state right',
                                   window,
                                   triggered=partial(_move_checked_state,
                                                     left_view, right_view))
    toolbar.addAction(move_selection_left)
    toolbar.addAction(move_selection_right)

    window.show()
    app.exec_()
예제 #3
0
def get_iface():
    """
    Will return a mock QgisInterface object with some methods implemented in a generic way.

    You can further control its behavior
    by using the mock infrastructure. Refer to https://docs.python.org/3/library/unittest.mock.html
    for more details.

        Returns
        -------
        QgisInterface

        A mock QgisInterface
    """

    start_app()

    my_iface = mock.Mock(spec=QgisInterface)

    my_iface.mainWindow.return_value = QMainWindow()

    canvas = QgsMapCanvas(my_iface.mainWindow())
    canvas.resize(QSize(400, 400))

    my_iface.mapCanvas.return_value = canvas

    return my_iface
예제 #4
0
def main():
    from calibre.gui2 import Application
    from PyQt4.QtGui import QMainWindow
    app = Application([])
    w = QMainWindow()
    w.show()
    p = ProceedQuestion(None)
    p(lambda p, q: None,
      None,
      'ass',
      'ass',
      'testing',
      'testing',
      checkbox_msg='testing the ruddy checkbox',
      det_msg='details')
    p(lambda p: None,
      None,
      'ass2',
      'ass2',
      'testing2',
      'testing2',
      det_msg='details shown first',
      show_det=True,
      show_ok=True,
      geom_pref='ProceedQuestion-unit-test')
    app.exec_()
예제 #5
0
    def __init__(self, parent):
        """Copies the properties from the parent (WebkitRenderer) object,
        creates the required instances of QWebPage, QWebView and QMainWindow
        and registers some Slots.
        """
        QObject.__init__(self)

        # Copy properties from parent
        for key, value in parent.__dict__.items():
            setattr(self, key, value)

        # Create and connect required PyQt4 objects
        self._page = QWebPage()
        self._view = QWebView()
        self._view.setPage(self._page)
        self._window = QMainWindow()
        self._window.setCentralWidget(self._view)

        # Import QWebSettings
        for key, value in self.qWebSettings.iteritems():
            self._page.settings().setAttribute(key, value)

        # Connect required event listeners
        self.connect(
            self._page, SIGNAL("loadFinished(bool)"),
            self._on_load_finished
        )
        self.connect(
            self._page, SIGNAL("loadStarted()"),
            self._on_load_started
        )
        self.connect(
            self._page.networkAccessManager(),
            SIGNAL("sslErrors(QNetworkReply *,const QList<QSslError>&)"),
            self._on_ssl_errors
        )
        self.connect(
            self._page.networkAccessManager(),
            SIGNAL("finished(QNetworkReply *)"), self._on_each_reply
        )

        # The way we will use this, it seems to be unesseccary to have
        # Scrollbars enabled.
        self._page.mainFrame().setScrollBarPolicy(
            Qt.Horizontal, Qt.ScrollBarAlwaysOff
        )
        self._page.mainFrame().setScrollBarPolicy(
            Qt.Vertical, Qt.ScrollBarAlwaysOff
        )
        self._page.settings().setUserStyleSheetUrl(
            QUrl("data:text/css,html,body{overflow-y:hidden !important;}")
        )

        # Show this widget
        self._window.show()
예제 #6
0
    def __init__(self, argv):



        QApplication.__init__(self, argv)

        # main window
        self.__mainWindow = QMainWindow()
        self.__ui1 = Ui_MainWindow()
        self.__glMain = object()
        self.__stl_model = StlModel()
        self.__stl_view = None

        # printing dialog
        self.__printingDialog = QDialog()
        self.__ui2 = Ui_PrintingDialog()

        # printing window
        self.__printingWindow = QMainWindow()
        self.__ui3 = Ui_PrintingWindow()
        self.__glStatus = object()

        # printer settings
        self.__printerSettings = QDialog()
        self.__ui4 = Ui_PrinterSettings()

        # slicing dialog
        # ToDo find something working as DropDown or get ComboBox working
        #self.__ui5 = ...

        # slicing window
        self.__glSlice = object()
        self.__slicingwindow = QMainWindow()
        self.__ui6 = Ui_SlicingWindow()
        self.__slicing_model = None
        self.__slicing_view = None
        self.__slices = None
        self.__slicing_index = 0

        self.__connection = None
        self.__config = ConfigurationModel()
        self.current_z = 0
예제 #7
0
 def testExample(self):
     logging.debug(self.__class__.__name__ +': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.app.setActiveWindow(self.window)
     self._boxContentDialog=BoxContentDialog(self.window)
     self._boxContentDialog.addButton("&label","str(object.label)")
     self.app.connect(self._boxContentDialog, SIGNAL("scriptChanged"), self.scriptChanged)
     self._boxContentDialog.onScreen()
     if not hasattr(unittest,"NO_GUI_TEST"):
         self.app.exec_()
def abrir():
    MainWindow = QMainWindow()

    ui = VentanaInterprete()
    ui.setupUi(MainWindow)

    utils.centrar_ventana(MainWindow)
    MainWindow.show()
    MainWindow.raise_()

    return MainWindow
예제 #9
0
def abrir():
    MainWindow = QMainWindow()

    ui = VentanaInterprete()
    ui.setupUi(MainWindow)

    utils.centrar_ventana(MainWindow)
    MainWindow.show()
    MainWindow.raise_()
    pilasengine.utils.destacar_ventanas()
    return MainWindow
예제 #10
0
    def toggleInspector(self):
        if self.__inspector_window is None:
            self.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
            web_inspector = QWebInspector()
            web_inspector.setPage(self.page())

            self.__inspector_window = QMainWindow(self)
            self.__inspector_window.setCentralWidget(web_inspector)
            self.__inspector_window.resize(900, 600)
            self.__inspector_window.setVisible(False)

        self.__inspector_window.setVisible(not self.__inspector_window.isVisible())
예제 #11
0
    def __init__(self):
        super().__init__()

        self.hist = None
        self.lines = []

        self.gameWindow = QMainWindow()
        self.setupUi(self.gameWindow)

        init_fchooser(self.fname_button, self.fname_edit, 'Dataset file')
        self.open_button.clicked.connect(self.load)
        self.run_button.clicked.connect(self.run_trade)
def abrir_script_con_livereload(archivo):
    MainWindow = QMainWindow()

    ui = VentanaInterprete()
    ui.setupUi(MainWindow)

    utils.centrar_ventana(MainWindow)
    MainWindow.show()
    MainWindow.raise_()
    ui.ejecutar_y_reiniciar_si_cambia(archivo)

    ui.colapsar_interprete()
    return MainWindow
예제 #13
0
def main():

    app = QApplication(sys.argv)
    win = QMainWindow()

    data = example_data.simple_image()
    dc = DataCollection([data])
    histo_client = HistogramWidget(dc)

    hub = Hub(dc, histo_client)
    win.setCentralWidget(histo_client)
    win.show()
    sys.exit(app.exec_())
예제 #14
0
def main():
    app = QApplication(sys.argv)

    window = QMainWindow()
    central_widget = QWidget(window)

    start_action = QAction('Start', window)
    stop_action = QAction('Stop', window)
    toolbar = window.addToolBar('Monitor')
    toolbar.addAction(start_action)
    toolbar.addAction(stop_action)

    central_layout = QVBoxLayout(central_widget)

    monitor_name = QLabel(central_widget)
    central_layout.addWidget(monitor_name)

    state_label = QLabel(central_widget)
    central_layout.addWidget(state_label)

    combo_box = QComboBox(central_widget)
    items = [('No keys', AbstractKeyboardMonitor.IGNORE_NO_KEYS),
             ('Modifiers', AbstractKeyboardMonitor.IGNORE_MODIFIER_KEYS),
             ('Modifier combos',
              AbstractKeyboardMonitor.IGNORE_MODIFIER_COMBOS)]
    for label, userdata in items:
        combo_box.addItem(label, userdata)

    def _update_ignore_keys(index):
        monitor.keys_to_ignore = combo_box.itemData(index).toPyObject()

    combo_box.currentIndexChanged[int].connect(_update_ignore_keys)
    central_layout.addWidget(combo_box)

    central_widget.setLayout(central_layout)
    window.setCentralWidget(central_widget)

    monitor = create_keyboard_monitor(window)
    monitor_name.setText('Using monitor class {0}'.format(
        monitor.__class__.__name__))
    monitor.typingStarted.connect(partial(state_label.setText, 'typing'))
    monitor.typingStopped.connect(partial(state_label.setText, 'not typing'))
    start_action.triggered.connect(monitor.start)
    stop_action.triggered.connect(monitor.stop)
    stop_action.setEnabled(False)
    monitor.started.connect(partial(start_action.setEnabled, False))
    monitor.started.connect(partial(stop_action.setEnabled, True))
    monitor.stopped.connect(partial(start_action.setEnabled, True))
    monitor.stopped.connect(partial(stop_action.setEnabled, False))
    window.show()
    app.exec_()
예제 #15
0
 def testExample(self):
     logging.debug(self.__class__.__name__ + ': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle("test PropertyView")
     self.app.setActiveWindow(self.window)
     self.window.show()
     self.propertyView = PropertyView(self.window)
     self.window.setCentralWidget(self.propertyView)
     self.propertyView.setDataAccessor(TestDataAccessor())
     self.propertyView.setDataObject("particle1")
     self.propertyView.updateContent()
     if not hasattr(unittest, "NO_GUI_TEST"):
         self.app.exec_()
예제 #16
0
 def testExample(self):
     logging.debug(self.__class__.__name__ +': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle("test ToolBoxContainer")
     self.app.setActiveWindow(self.window)
     self.window.show()
     container = ToolBoxContainer(self.window)
     self.window.setCentralWidget(container)
     container.addWidget(QTextEdit("ganz viel text\n mit zeilenumbruechen\n."))
     container.addWidget(QTextEdit("anderer inhalt."))
     container.show()
     if not hasattr(unittest,"NO_GUI_TEST"):
         self.app.exec_()
예제 #17
0
def main():
    """ Display a layer tree """
    from PyQt4.QtGui import QApplication, QMainWindow
    import sys

    hub = glue.Hub()
    app = QApplication(sys.argv)
    win = QMainWindow()
    ltw = LayerTreeWidget()
    ltw.register_to_hub(hub)
    ltw.data_collection.register_to_hub(hub)
    win.setCentralWidget(ltw)
    win.show()
    sys.exit(app.exec_())
예제 #18
0
def abrir_script_con_livereload(archivo):
    MainWindow = QMainWindow()

    ui = VentanaInterprete()
    ui.setupUi(MainWindow)

    utils.centrar_ventana(MainWindow)
    MainWindow.show()
    ui.colapsar_interprete()
    MainWindow.raise_()
    ui.editor.abrir_archivo_del_proyecto(archivo)
    ui.editor.ejecutar()

    return MainWindow
예제 #19
0
 def create_mainwindow(self):
     """
     Create a QMainWindow instance containing this plugin
     Note: this method is currently not used
     """
     self.mainwindow = mainwindow = QMainWindow()
     mainwindow.setAttribute(Qt.WA_DeleteOnClose)
     icon = self.get_widget_icon()
     if isinstance(icon, basestring):
         icon = get_icon(icon)
     mainwindow.setWindowIcon(icon)
     mainwindow.setWindowTitle(self.get_plugin_title())
     mainwindow.setCentralWidget(self)
     self.refresh_plugin()
     return mainwindow
예제 #20
0
파일: status.py 프로젝트: koll00/Gui_SM
def test():
    from PyQt4.QtGui import QMainWindow
    from SMlib.utils.qthelpers import qapplication
    app = qapplication()
    win = QMainWindow()
    win.setWindowTitle("Status widgets test")
    win.resize(900, 300)
    statusbar = win.statusBar()
    swidgets = []
    for klass in (ReadWriteStatus, EOLStatus, EncodingStatus,
                  CursorPositionStatus, MemoryStatus, CPUStatus):
        swidget = klass(win, statusbar)
        swidgets.append(swidget)
    win.show()
    app.exec_()
예제 #21
0
 def testExample(self):
     logging.debug(self.__class__.__name__ + ': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle("test TreeView")
     self.app.setActiveWindow(self.window)
     self.window.show()
     self.treeView = TreeView(self.window)
     self.window.setCentralWidget(self.treeView)
     accessor = TestDataAccessor()
     self.treeView.setDataAccessor(accessor)
     self.treeView.setDataObjects(accessor.topLevelObjects())
     self.treeView.updateContent()
     if not hasattr(unittest, "NO_GUI_TEST"):
         self.app.exec_()
예제 #22
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        # dynamically load ui
        uiFile = "MDIMainWindow.ui"  # change to desired relative ui file path
        if not os.path.isfile(uiFile):
            uiFile = os.path.join('gui', "MDIMainWindow.ui")

        self.ui = QMainWindow()
        self.ui = uic.loadUi(uiFile, self)

        self.init()
        self.initUi()

        self.ui.show()
예제 #23
0
def test():
    from PyQt4.QtGui import QApplication, QMainWindow
    app = QApplication([])
    w = QMainWindow()
    cf = CoverFlow()
    cf.resize(int(available_width() / 1.5), available_height() - 60)
    w.resize(cf.size() + QSize(30, 20))
    model = DummyImageList()
    cf.setImages(model)
    cf.setCurrentSlide(39000)
    w.setCentralWidget(cf)

    w.show()
    cf.setFocus(Qt.OtherFocusReason)
    sys.exit(app.exec_())
예제 #24
0
    def __init__(self, renderer, scene, title):
        QApplication.__init__(self, sys.argv)
        self.window = QMainWindow()
        self.window.setWindowTitle(title)
        self.window.resize(800, 600)

        # Get OpenGL 4.1 context
        glformat = QGLFormat()
        glformat.setVersion(4, 1)
        glformat.setProfile(QGLFormat.CoreProfile)
        glformat.setDoubleBuffer(False)

        self.glwidget = MyGlWidget(renderer, glformat, self, scene)
        self.window.setCentralWidget(self.glwidget)

        self.window.show()
예제 #25
0
파일: scatter.py 프로젝트: hihihippp/glue
def main():

    app = QApplication(sys.argv)
    win = QMainWindow()

    data, data2, s, s2 = glue.example_data.pipe()
    dc = glue.DataCollection([data, data2])
    scatter_client = ScatterWidget(dc)
    message_client = MessageWidget()
    hub = glue.Hub(data, data2, dc, scatter_client, data.edit_subset,
                   message_client)
    #    scatter_client.add_layer(data)
    #    scatter_client.add_layer(data2)
    win.setCentralWidget(scatter_client)
    win.show()
    #message_client.show()
    sys.exit(app.exec_())
예제 #26
0
 def testExample(self):
     logging.debug(self.__class__.__name__ + ': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle("test ZoomableWidget")
     self.window.resize(300, 300)
     self.app.setActiveWindow(self.window)
     self.window.show()
     self.scrollArea = ZoomableScrollArea(self.window)
     self.window.setCentralWidget(self.scrollArea)
     self.zoomableWidget = ZoomableWidget()
     self.scrollArea.setWidget(self.zoomableWidget)
     self.widget = VispaWidget(self.zoomableWidget)
     self.widget.move(10, 10)
     self.widget.show()
     if not hasattr(unittest, "NO_GUI_TEST"):
         self.app.exec_()
예제 #27
0
    def __init__(self, filename, width, height):
        self._listeners = []
        self.app = QApplication(sys.argv)
        self.win = QMainWindow()
        self.win.resize(width, height)
        self.browser = QWebView(_win)
        filename = os.path.abspath(filename)
        self.browser.setUrl(QUrl(filename))
        filename = filename.split("?")[0]
        path, path = os.path.split(filename)
        self.browser.setHtml(
            open(filename).read(), QUrl.fromLocalFile(filename))
        self.win.setCentralWidget(self.browser)
        self.win.show()

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module
        set_main_frame(self)
예제 #28
0
 def testExample(self):
     logging.debug(self.__class__.__name__ + ': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.app.setActiveWindow(self.window)
     self._findAlgoritm = FindAlgorithm()
     accessor = TestDataAccessor()
     self._findAlgoritm.setDataAccessor(accessor)
     self._findAlgoritm.setDataObjects(accessor.topLevelObjects())
     self._findDialog = FindDialog(self.window)
     self._findDialog.setFindAlgorithm(self._findAlgoritm)
     self._findDialog.setLabel("particle")
     self.app.connect(self._findDialog, SIGNAL("found"), self.found)
     self._found = False
     self._findDialog.findNext()
     self.assertEqual(self._found, True)
     self._findDialog.onScreen()
     if not hasattr(unittest, "NO_GUI_TEST"):
         self.app.exec_()
예제 #29
0
    def __init__(self):
        QMainWindow.__init__(self)
        # Esto para tener widgets laterales en full height,
        window = QMainWindow(self)
        self.setWindowTitle('{' + ui.__edis__ + '}')
        self.setMinimumSize(750, 500)
        # Se cargan las dimensiones de la ventana
        if settings.get_setting('window/show-maximized'):
            self.setWindowState(Qt.WindowMaximized)
        else:
            size = settings.get_setting('window/size')
            position = settings.get_setting('window/position')
            self.resize(size)
            self.move(position)
        # Toolbars
        self.toolbar = QToolBar(self)
        self.toolbar.setObjectName("toolbar")
        toggle_action = self.toolbar.toggleViewAction()
        toggle_action.setText(self.tr("Toolbar"))
        self.toolbar.setIconSize(QSize(24, 24))
        self.toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly)
        self.addToolBar(Qt.RightToolBarArea, self.toolbar)
        Edis.load_component("toolbar", self.toolbar)
        # Animated property
        self.setDockOptions(QMainWindow.AnimatedDocks)
        # Menú
        menu_bar = self.menuBar()
        self.setup_menu(menu_bar)
        # Barra de estado
        self.status_bar = Edis.get_component("status_bar")
        self.setStatusBar(self.status_bar)
        # Widget central
        central = self._load_ui(window)
        window.setCentralWidget(central)
        window.setWindowFlags(Qt.Widget)
        self.setCentralWidget(window)

        Edis.load_component("edis", self)
        # Comprobar nueva versión
        if settings.get_setting('general/check-updates'):
            self.noti = system_tray.NotificacionActualizacion()
            self.noti.show()
예제 #30
0
파일: ide_test.py 프로젝트: danielfmva/ert
def main():
    if len(sys.argv) == 1:
        print("Missing configuration file!")
        sys.exit(1)

    QApplication.setGraphicsSystem("raster")
    app = QApplication(
        sys.argv)  #Early so that QT is initialized before other imports

    main_window = QMainWindow()

    central_widget = QWidget()
    main_window.setCentralWidget(central_widget)
    layout = QVBoxLayout()
    central_widget.setLayout(layout)

    search = SearchBox()

    ide = IdePanel()

    layout.addWidget(search)
    layout.addWidget(ide, 1)

    path = sys.argv[1]
    with open(path) as f:
        config_file = f.read()

    highlighter = KeywordHighlighter(ide.document())

    search.filterChanged.connect(highlighter.setSearchString)

    ide.document().setPlainText(config_file)

    cursor = ide.textCursor()
    cursor.setPosition(0)
    ide.setTextCursor(cursor)
    ide.setFocus()

    main_window.show()

    sys.exit(app.exec_())