Exemplo n.º 1
0
def main():
    app = QApplication(sys.argv)

    mdi = MdiMainWindow(app)    
    mdi.show()
    if len(sys.argv)==2:
        mdi.open_path(QtCore.QString(sys.argv[1]))
    sys.exit(app.exec_())
Exemplo n.º 2
0
def main():

    app = QApplication([])

    view = QWebView()
    fac = PluginFactory()
    view.page().setPluginFactory(fac)
    QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled,
                                               True)

    view.load(QUrl(sys.argv[1]))

    view.resize(840, 600)
    view.show()

    return app.exec_()
Exemplo n.º 3
0
    def __init__(self, name, session):
        # export this object to dbus
        dbus.service.Object.__init__(self, name, session)

        # create a simple widget
        self.widget = QPushButton()
        self.widget.resize(200, 50)

        # To export a Qt signal as a DBus-signal, you need to connect it to a method in this class.
        # The method MUST have the signal annotation, so python-dbus will export it as a dbus-signal
        QObject.connect(self.widget, SIGNAL("clicked()"), self.clicked)
        QObject.connect(QApplication.instance(), SIGNAL("lastWindowClosed()"), self.lastWindowClosed)
Exemplo n.º 4
0
    def __init__(self, name, session):
        # export this object to dbus
        dbus.service.Object.__init__(self, name, session)

        # create a simple widget
        self.widget = QPushButton()
        self.widget.resize(200, 50)

        # To export a Qt signal as a DBus-signal, you need to connect it to a method in this class.
        # The method MUST have the signal annotation, so python-dbus will export it as a dbus-signal
        QObject.connect(self.widget, SIGNAL("clicked()"), self.clicked)
        QObject.connect(QApplication.instance(), SIGNAL("lastWindowClosed()"), self.lastWindowClosed)
Exemplo n.º 5
0
    def run_test():

        from PySide2.QtGui import QApplication
        import sys

        app = QApplication([])

        editor = QCodeEditor(DISPLAY_LINE_NUMBERS=True,
                             HIGHLIGHT_CURRENT_LINE=True,
                             SyntaxHighlighter=PythonHighlighter)

        # 		text = '''<FINITELATTICE>
        #   <LATTICE name="myLattice">
        # 	<BASIS>
        # 	  <VECTOR>1.0 0.0 0.0</VECTOR>
        # 	  <VECTOR>0.0 1.0 0.0</VECTOR>
        # 	</BASIS>
        #   </LATTICE>
        #   <PARAMETER name="L" />
        #   <PARAMETER default="L" name="W" />
        #   <EXTENT dimension="1" size="L" />
        #   <EXTENT dimension="2" size="W" />
        #   <BOUNDARY type="periodic" />
        # </FINITELATTICE>
        # '''
        text = """\
def hello(text):
	print(text)

hello('Hello World')

# Comment"""
        editor.setPlainText(text)
        editor.resize(400, 250)
        editor.show()

        sys.exit(app.exec_())
Exemplo n.º 6
0
#!/usr/bin/env python

import sys
from pivy.gui.soqt import SoQt
from PySide2.QtGui import QApplication
from PySide2.QtCore import QObject
from PySide2.QtCore import SIGNAL
from PySide2.QtCore import SLOT
from mainwindow import MainWindow

if __name__ == "__main__":

    SoQt.init(None)
    app = QApplication(sys.argv)
    window = MainWindow()
    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    window.show()
    sys.exit(app.exec_())
Exemplo n.º 7
0
import pyqtgraph as pg
## Switch to using white background and black foreground
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')


class PlotB(QWidget):
    def __init__(self, parent=None):
        super(PlotB, self).__init__(parent)

        self.win = pg.GraphicsWindow()
        self.p = self.createAxis(self.win)
        my_layout = QVBoxLayout()
        my_layout.addWidget(self.win)
        self.setLayout(my_layout)

    def createAxis(self, window):
        p = window.addPlot()
        p.setLabel('bottom', text='T', units='Sec')
        p.setLabel('left', text="N,  B1, B")
        p.showGrid(x=True, y=True)
        p.setXRange(0, 4.5, padding=0)
        p.setYRange(0, 4, padding=0)
        return p


if __name__ == '__main__':
    app = QApplication(sys.argv)
    form = PlotB()
    form.show()
    app.exec_()
Exemplo n.º 8
0
    @dbus.service.method("com.example.SampleWidget",
                         in_signature='',
                         out_signature='')
    def exit(self):
        qApp().quit()

    # A signal that will be exported to dbus
    @dbus.service.signal("com.example.SampleWidget", signature='')
    def clicked(self):
        pass

    # Another signal that will be exported to dbus
    @dbus.service.signal("com.example.SampleWidget", signature='')
    def lastWindowClosed(self):
        pass


if __name__ == '__main__':
    app = QApplication([])
    # Use qt/glib mainloop integration to get dbus mainloop working
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    session_bus = dbus.SessionBus()
    # Export the service
    name = dbus.service.BusName("com.example.SampleService", session_bus)
    # Export the object
    widget = DBusWidget(session_bus, '/DBusWidget')

    print "Running example service."
    app.exec_()
Exemplo n.º 9
0
    # Another one...
    @dbus.service.method("com.example.SampleWidget", in_signature='', out_signature='')
    def exit(self):
        qApp().quit()

    # A signal that will be exported to dbus
    @dbus.service.signal("com.example.SampleWidget", signature='')
    def clicked(self):
        pass

    # Another signal that will be exported to dbus
    @dbus.service.signal("com.example.SampleWidget", signature='')
    def lastWindowClosed(self):
        pass


if __name__ == '__main__':
    app = QApplication([])
    # Use qt/glib mainloop integration to get dbus mainloop working
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    session_bus = dbus.SessionBus()
    # Export the service
    name = dbus.service.BusName("com.example.SampleService", session_bus)
    # Export the object
    widget = DBusWidget(session_bus, '/DBusWidget')

    print "Running example service."
    app.exec_()