Пример #1
0
def main():
    global dbus
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="increase output verbosity",
                        action="store_true")
    args = parser.parse_args()
    QtQml.qmlRegisterType(QmlPage, "djpdf", 1, 0, "DjpdfPage")
    app = QApplication([])
    engine = QQmlApplicationEngine()
    thumbnail_image_provider = ThumbnailImageProvider()
    engine.addImageProvider("thumbnails", thumbnail_image_provider)
    ctx = engine.rootContext()
    pages_model = QmlPagesModel(verbose=args.verbose)
    if os.environ.get("DJPDF_PLATFORM_INTEGRATION", "") == "flatpak":
        import dbus
        import dbus.mainloop.glib
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        bus = dbus.SessionBus()
        platform_integration = QmlFlatpakPlatformIntegration(bus)
    else:
        platform_integration = QmlPlatformIntegration()
    ctx.setContextProperty("pagesModel", pages_model)
    ctx.setContextProperty("platformIntegration", platform_integration)
    engine.load(QUrl.fromLocalFile(
        os.path.join(QML_DIR, "main.qml")))
    if os.environ.get("DJPDF_PLATFORM_INTEGRATION", "") == "flatpak":
        platform_integration.win_id = engine.rootObjects()[0].winId()
    exit(app.exec_())
Пример #2
0
def run_main():
    import sys
    from PySide2.QtWidgets import QApplication
    app = QApplication(sys.argv)
    mw = AddressWidget()
    mw.show()
    sys.exit(app.exec_())
Пример #3
0
def main():
    app = QApplication(sys.argv)

    window = MainWindow()
    window.show()

    app.exec_()
Пример #4
0
def main():
    app = QApplication([])
    QtWebEngine.initialize()
    engine = QQmlApplicationEngine()
    qml_file_path = os.path.join(os.path.dirname(__file__), 'browser.qml')
    qml_url = QUrl.fromLocalFile(os.path.abspath(qml_file_path))
    engine.load(qml_url)
    app.exec_()
Пример #5
0
 def testInstanceObject(self):
     TestObject.createApp()
     app1 = QApplication.instance()
     app2 = QApplication.instance()
     app1.setObjectName("MyApp")
     self.assertEqual(app1, app2)
     self.assertEqual(app2.objectName(), app1.objectName())
     app1.destroyed.connect(self.appDestroyed)
Пример #6
0
    def testIt(self):
        app = QApplication([])
        self.box = MySpinBox()
        self.box.show()

        QTimer.singleShot(0, self.sendKbdEvent)
        QTimer.singleShot(100, app.quit)
        app.exec_()

        self.assertEqual(self.box.text(), '0')
Пример #7
0
 def round(self, tile: TicTacToe.Tile):
     QApplication.setOverrideCursor(Qt.WaitCursor)
     self.player.tile = tile
     score = self.ticTacToe.round(True)
     QApplication.restoreOverrideCursor()
     if score is not None:
         if score == +1:
             QMessageBox.information(self, self.tr("Victory!"), self.tr("You won :)"), QMessageBox.Ok)
         if score == 0:
             QMessageBox.warning(self, self.tr("Tie!"), self.tr("You tied :|"), QMessageBox.Ok)
         if score == -1:
             QMessageBox.critical(self, self.tr("Defeat!"), self.tr("You lost :("), QMessageBox.Ok)
         self.ticTacToe.reset(True)
Пример #8
0
 def round(self, disc: FourPlay.Disc):
     QApplication.setOverrideCursor(Qt.WaitCursor)
     self.player.disc = disc
     score = self.fourPlay.round(True)
     QApplication.restoreOverrideCursor()
     if score is not None:
         if score == +1:
             QMessageBox.information(self, self.tr("Victory!"), self.tr("You won :)"), QMessageBox.Ok)
         if score == 0:
             QMessageBox.warning(self, self.tr("Tie!"), self.tr("You tied :|"), QMessageBox.Ok)
         if score == -1:
             QMessageBox.critical(self, self.tr("Defeat!"), self.tr("You lost :("), QMessageBox.Ok)
         self.fourPlay.reset(True)
Пример #9
0
    def saveFile(self, fileName):
        file = QFile(fileName)

        if not file.open(QFile.WriteOnly | QFile.Text):
            QMessageBox.warning(self, "MDI",
                    "Cannot write file %s:\n%s." % (fileName, file.errorString()))
            return False

        outstr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        outstr << self.toPlainText()
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)
        return True
Пример #10
0
    def about_text(self):
        self._window.label_3 = QLabel()
        self._window.label_3.setTextFormat(Qt.RichText)
        self._window.label_3.setOpenExternalLinks(True)
        self._window.label_3.setLocale(QLocale(QLocale.English,
                                               QLocale.UnitedStates))
        self._window.label_3.setScaledContents(True)
        self._window.label_3.setWordWrap(True)
        text = """
<html>
<head/>
<body>
  <p>poliBeePsync is a program written by Davide Olianas,
released under GNU GPLv3+.</p>
  <p>Feel free to contact me at <a
  href=\"mailto:[email protected]\">[email protected]</a> for
  suggestions and bug reports.</p>
  <p>More information is available on the
  <a href=\"http://www.davideolianas.com/polibeepsync\">
  <span style=\" text-decoration: underline; color:#0000ff;\">
  official website</span></a>.
  </p>
</body>
</html>
"""

        self._window.label_3.setText(QApplication.translate("Form", text,
                                                            None))
Пример #11
0
    def loadFile(self, fileName):
        file = QFile(fileName)
        if not file.open(QFile.ReadOnly | QFile.Text):
            QMessageBox.warning(self, "MDI",
                    "Cannot read file %s:\n%s." % (fileName, file.errorString()))
            return False

        instr = QTextStream(file)
        QApplication.setOverrideCursor(Qt.WaitCursor)
        self.setPlainText(instr.readAll())
        QApplication.restoreOverrideCursor()

        self.setCurrentFile(fileName)

        self.document().contentsChanged.connect(self.documentWasModified)

        return True
Пример #12
0
def main():
    # load options from cmdline
    parser = create_parser()
    args = parser.parse_args()

    # set debug levels
    LEVELS = {
        'notset': logging.NOTSET,
        'debug': logging.DEBUG,
        'info': logging.INFO,
        'warning': logging.WARNING,
        'error': logging.ERROR,
        'critical': logging.CRITICAL,
    }

    level_name = 'info'
    if args.debug:
        level_name = args.debug
    level = LEVELS.get(level_name, logging.INFO)

    # now get the logger used in the common module and set its level to what
    # we get from sys.argv
    commonlogger.setLevel(level)
    logger.setLevel(level)

    formatter = logging.Formatter('[%(levelname)s] %(name)s %(message)s')

    handler = logging.StreamHandler(stream=sys.stdout)
    handler.setFormatter(formatter)
    handler.setLevel(logging.DEBUG)

    logger.addHandler(handler)
    commonlogger.addHandler(handler)

    app = QApplication(sys.argv)

    frame = MainWindow()
    # args is defined at the top of this module
    if not args.hidden:
        # Need to fix showing wrong window
        frame.show()

    sys.exit(app.exec_())
Пример #13
0
 def getCheckBoxRect(self, option):
     check_box_style_option = QStyleOptionButton()
     check_box_rect = QApplication.style().subElementRect(
         QStyle.SE_CheckBoxIndicator, check_box_style_option, None)
     check_box_point = QPoint(option.rect.x() +
                              option.rect.width() / 2 -
                              check_box_rect.width() / 2,
                              option.rect.y() +
                              option.rect.height() / 2 -
                              check_box_rect.height() / 2)
     return QRect(check_box_point, check_box_rect.size())
Пример #14
0
 def __init__(self):
     QCoreApplication.setOrganizationName('DynArt')
     QCoreApplication.setApplicationName('TilePad')
     QCoreApplication.setApplicationVersion('0.4.0')
     if getattr(sys, 'frozen', False):
         self.dir = os.path.dirname(sys.executable)
     else:
         self.dir = os.path.dirname(__file__)
     self.dir = self.dir.replace('\\', '/')
     self.qApp = QApplication(sys.argv)
     self.mainWindow = MainWindow(self)
Пример #15
0
    def testQClipboard(self):
        # skip this test on MacOS because the clipboard is not available during the ssh session
        # this cause problems in the buildbot
        if sys.platform == "darwin":
            return
        clip = QApplication.clipboard()
        clip.setText("Testing this thing!")

        text, subtype = clip.text("")
        self.assertEqual(subtype, "plain")
        self.assertEqual(text, "Testing this thing!")
Пример #16
0
def createNextWebView():
    global functionID

    nListCount = len(FUNCTIONS_LIST) - 1
    functionID = functionID + 1
    print functionID

    if functionID < nListCount:
        createWebView( functionID )
    else:
        QTimer.singleShot(300, QApplication.instance().quit)
Пример #17
0
def main():
    app = QApplication(sys.argv)

    root = coin.SoSeparator()
    

    vert = coin.SoVertexShader()
    vert.sourceProgram = "vertex.glsl"
    
    frag = coin.SoFragmentShader()
    frag.sourceProgram = "frag.glsl"
    
    shaders = [vert,frag]
    pro = coin.SoShaderProgram()
    pro.shaderObject.setValues(0,len(shaders),shaders)
    
    
    mat = coin.SoMaterial()
    mat.diffuseColor.setValue(coin.SbColor(0.8, 0.8, 0.8))
    mat.specularColor.setValue(coin.SbColor(1, 1, 1))
    mat.shininess.setValue(1.0)
    mat.transparency.setValue(0.5)
    
    
    
    
    sphere = coin.SoSphere()
    sphere.radius = 1.2
    
    
    root.addChild(pro)
    root.addChild(sphere)
    root.addChild(mat)
    root.addChild(coin.SoCube())

    viewer = quarter.QuarterWidget()
    viewer.setSceneGraph(root)

    viewer.setWindowTitle("minimal")
    viewer.show()
    sys.exit(app.exec_())
Пример #18
0
class TilePad(object):

    Instance = None

    @staticmethod
    def Run():
        TilePad.Instance = TilePad()
        return TilePad.Instance.run()

    def __init__(self):
        QCoreApplication.setOrganizationName('DynArt')
        QCoreApplication.setApplicationName('TilePad')
        QCoreApplication.setApplicationVersion('0.4.0')
        if getattr(sys, 'frozen', False):
            self.dir = os.path.dirname(sys.executable)
        else:
            self.dir = os.path.dirname(__file__)
        self.dir = self.dir.replace('\\', '/')
        self.qApp = QApplication(sys.argv)
        self.mainWindow = MainWindow(self)

    def run(self):
        self.mainWindow.show()
        return self.qApp.exec_()
Пример #19
0
from PySide2.QtWidgets import QApplication, QMessageBox

__all__ = [
    'APP',
    'CLICKED',
    'YES',
    'NO',
    'YES_NO',
    'CANCEL',
    'YES_NO_CANCEL',
]

APP = QApplication([])
CLICKED = 'clicked()'

YES = QMessageBox.Yes
NO = QMessageBox.No
CANCEL = QMessageBox.Cancel
YES_NO = YES | NO
YES_NO_CANCEL = YES_NO | CANCEL
Пример #20
0
        self.webEngineView = QWebEngineView()
        self.setCentralWidget(self.webEngineView)
        initialUrl = 'http://qt.io'
        self.addressLineEdit.setText(initialUrl)
        self.webEngineView.load(QUrl(initialUrl))
        self.webEngineView.page().titleChanged.connect(self.setWindowTitle)
        self.webEngineView.page().urlChanged.connect(self.urlChanged)

    def load(self):
        url = QUrl.fromUserInput(self.addressLineEdit.text())
        if url.isValid():
            self.webEngineView.load(url)

    def back(self):
        self.webEngineView.page().triggerAction(QWebEnginePage.Back)

    def forward(self):
        self.webEngineView.page().triggerAction(QWebEnginePage.Forward)

    def urlChanged(self, url):
        self.addressLineEdit.setText(url.toString())

if __name__ == '__main__':
    app = QApplication(sys.argv)
    mainWin = MainWindow()
    availableGeometry = app.desktop().availableGeometry(mainWin)
    mainWin.resize(availableGeometry.width() * 2 / 3, availableGeometry.height() * 2 / 3)
    mainWin.show()
    sys.exit(app.exec_())
Пример #21
0
    def getSpaceText(pool):
        return "Size: " + str(pool.properties['size'].value) + ", " + str(
            pool.properties['free'].value) + " free"


if __name__ == "__main__":

    if getattr(sys, 'frozen', False):
        application_path = os.path.dirname(sys.executable)
    elif __file__:
        application_path = os.path.dirname(__file__)

    logging.basicConfig(level=logging.INFO)

    # Building the app
    app = QApplication([])
    app.setQuitOnLastWindowClosed(False)
    controller = AppController()
    icon = QIcon(
        os.path.join(application_path,
                     "assets/icons.iconset/icon_128x128.png"))
    green_icon = QIcon(os.path.join(application_path, "assets/green_dot.png"))
    yellow_icon = QIcon(os.path.join(application_path,
                                     "assets/yellow_dot.png"))
    red_icon = QIcon(os.path.join(application_path, "assets/red_dot.png"))
    grey_icon = QIcon(os.path.join(application_path, "assets/grey_dot.png"))
    tray = QSystemTrayIcon()
    tray.setIcon(icon)
    tray.setVisible(True)
    nc = NotificationCenter()
Пример #22
0
        self.statusBar().addWidget(download_widget)

    def _remove_download_requested(self):
            download_widget = self.sender()
            self.statusBar().removeWidget(download_widget)
            del download_widget

    def _show_find(self):
        if self._find_tool_bar is None:
            self._find_tool_bar = FindToolBar()
            self._find_tool_bar.find.connect(self._tab_widget.find)
            self.addToolBar(Qt.BottomToolBarArea, self._find_tool_bar)
        else:
            self._find_tool_bar.show()
        self._find_tool_bar.focus_find()

    def write_bookmarks(self):
        self._bookmark_widget.write_bookmarks()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    main_win = create_main_window()
    initial_urls = sys.argv[1:]
    if not initial_urls:
        initial_urls.append('http://qt.io')
    for url in initial_urls:
        main_win.load_url_in_new_tab(QUrl.fromUserInput(url))
    exit_code = app.exec_()
    main_win.write_bookmarks()
    sys.exit(exit_code)
Пример #23
0
 def testReturnOwnership(self):
     app = QApplication(sys.argv)
     webview = QWebView()
     webview.page().networkAccessManager().sslErrors.connect(self.onError)
Пример #24
0
 def retranslateUi(self, Form):
     self._window.label_2.setText(QApplication.translate("Form", "Password",
                                                         None))
     self._window.label.setText(QApplication.translate("Form", "User code",
                                                       None))
     self._window.trylogin.setText(
         QApplication.translate("Form", "Try logging in", None))
     self._window.check_version.setText(
         QApplication.translate("Form", "Check for new version", None))
     self._window.statusbar.showMessage(
         QApplication.translate("Form", "Login successful", None))
     self._window.label_4.setText(
         QApplication.translate("Form", "Root folder", None))
     self._window.changeRootFolder.setText(
         QApplication.translate("Form", "Change", None))
     self._window.label_5.setText(QApplication.translate("Form",
                                                         "Sync every",
                                                         None))
     self._window.label_6.setText(QApplication.translate("Form",
                                                         "minutes", None))
     self._window.syncNow.setText(QApplication.translate("Form",
                                                         "Sync now", None))
     self._window.addSyncNewCourses.setText(QApplication.translate("Form",
                                                           "Automatically add and sync new available courses",
                                                           None))
     self._window.tabWidget.setTabText(self._window.tabWidget.indexOf(self._window.settings_tab),
                               QApplication.translate("Form",
                                                      "Settings",
                                                      None))
     self._window.refreshCourses.setText(
         QApplication.translate("Form", "Refresh list", None))
     self._window.tabWidget.setTabText(self._window.tabWidget.indexOf(self._window.courses_tab),
                               QApplication.translate("Form", "Courses",
                                                      None))
     self._window.about.setText(QApplication.translate("Form", "About", None))
     self._window.tabWidget.setTabText(self._window.tabWidget.indexOf(self._window.status_tab),
                               QApplication.translate("Form", "Status",
                                                      None))
     self._window.tabWidget.setTabText(self._window.tabWidget.indexOf(self._window.plugins_tab),
                               QApplication.translate("Form", "Plugins",
                                                      None))
Пример #25
0
def main():
    multiprocessing.freeze_support()
    app = QApplication(sys.argv)
    app.setApplicationName("nfb-studio")
    app.setApplicationDisplayName("NFB Studio")
    app.setStyle(QStyleFactory.create("fusion"))

    if platform.system() == "Darwin":
        icon_dir = package.dir / "assets/window-icon/macos"
    else:
        icon_dir = package.dir / "assets/window-icon/generic"

    icon = QIcon()
    for file in icon_dir.glob("*"):
        icon.addFile(str(file))
    app.setWindowIcon(icon)

    main_window = ExperimentView()
    main_window.show()

    # If a file was passed as a command-line argument, load it
    if len(sys.argv) > 1:
        main_window.fileOpen(sys.argv[1])

    return app.exec_()
Пример #26
0
            self.m_suspendResumeButton.setText(self.RESUME_LABEL)
        elif self.m_audioOutput.state() == QAudio.StoppedState:
            qWarning("status: Stopped, resume()")
            self.m_audioOutput.resume()
            self.m_suspendResumeButton.setText(self.SUSPEND_LABEL)
        elif self.m_audioOutput.state() == QAudio.IdleState:
            qWarning("status: IdleState")

    stateMap = {
        QAudio.ActiveState: "ActiveState",
        QAudio.SuspendedState: "SuspendedState",
        QAudio.StoppedState: "StoppedState",
        QAudio.IdleState: "IdleState"
    }

    def handleStateChanged(self, state):
        qWarning("state = " + self.stateMap.get(state, "Unknown"))


if __name__ == '__main__':

    import sys

    app = QApplication(sys.argv)
    app.setApplicationName("Audio Output Test")

    audio = AudioTest()
    audio.show()

    sys.exit(app.exec_())
Пример #27
0
 def startup_check(self):
     QTimer.singleShot(200, QApplication.instance().quit)
Пример #28
0
class MainWindow(QDialog, Ui_Dialog):
    def __init__(self, app=None):
        super(MainWindow, self).__init__()
        self.app = app
        self.setupUi(self)

        self.city = DBComboBox(self.widget1,
                               datasession=s,
                               dataobject=City,
                               textcolumn="name")
        self.district = DBComboBox(self.widget2,
                                   datasession=s,
                                   dataobject=District,
                                   textcolumn="name")

        self.district.setMaster(self.city, "city_id")

        self.citylist = DBTableWidget(self.widget3,
                                      datasession=s,
                                      dataobject=City)
        self.show()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    mainWin = MainWindow(app)
    ret = app.exec_()
    app.exit()
    sys.exit(ret)
Пример #29
0
def test():
    import sys
    app = QApplication()
    win = MainWindow()
    win.show()
    sys.exit(app.exec_())
Пример #30
0
class BasicViewer(QMainWindow):
    """
    Simple class for viewing items.

    :param int width: Window width.
    :param int height: Window height.
    :param PySide.QtGui.QWidget parent: The parent widget.
    """
    def __init__(self, width=800, height=600, parent=None):
        if not has_pyside:
            raise ModuleNotFoundError("PySide was not found and is required.")
        # Start app
        self._app = QApplication.instance()
        if self._app is None:
            self._app = QApplication([])
        super(BasicViewer, self).__init__(parent)

        # Window settings
        self.setWindowTitle('pyOCCT')
        _icon = os.path.dirname(__file__) + '/_resources/icon.png'
        _qicon = QIcon(_icon)
        self.setWindowIcon(_qicon)

        # Create the OCCT view
        self._the_view = View(self)
        self.setCentralWidget(self._the_view)

        self.show()
        self.resize(width, height)

    @property
    def view(self):
        return self._the_view

    def keyPressEvent(self, e):
        if e.key() == ord('F'):
            self.view.fit()
        elif e.key() == ord('0'):
            self.view.view_iso()
        elif e.key() == ord('1'):
            self.view.view_front()
        elif e.key() == ord('2'):
            self.view.view_top()
        elif e.key() == ord('3'):
            self.view.view_right()
        elif e.key() == ord('4'):
            self.view.view_rear()
        elif e.key() == ord('5'):
            self.view.view_bottom()
        elif e.key() == ord('6'):
            self.view.view_left()
        elif e.key() == ord('S'):
            self.view.set_display_mode('s')
        elif e.key() == ord('W'):
            self.view.set_display_mode('w')
        else:
            print('Key is not mapped to anything.')

    def display_shape(self,
                      shape,
                      rgb=None,
                      transparency=None,
                      material=Graphic3d_NOM_DEFAULT):
        """
        Display a shape.

        :param OCCT.TopoDS.TopoDS_Shape shape: The shape.
        :param rgb: The RGB color (r, g, b).
        :type rgb: collections.Sequence[float] or OCCT.Quantity.Quantity_Color
        :param float transparency: The transparency (0 to 1).
        :param OCCT.Graphic3d.Graphic3d_NameOfMaterial material: The material.

        :return: The AIS_Shape created for the part.
        :rtype: OCCT.AIS.AIS_Shape
        """
        return self.view.display_shape(shape, rgb, transparency, material)

    def add(self,
            entity,
            rgb=None,
            transparency=None,
            material=Graphic3d_NOM_DEFAULT,
            mode=None):
        """
        Add an entity to the view.

        :param entity: The entity.
        :param rgb: The RGB color (r, g, b).
        :type rgb: collections.Sequence[float] or OCCT.Quantity.Quantity_Color
        :param float transparency: The transparency (0 to 1).
        :param OCCT.Graphic3d.Graphic3d_NameOfMaterial material: The material.
        :param int mode: Display mode for mesh elements (1=wireframe, 2=solid).

        :return: The AIS_Shape created for the entity. Returns *None* if the
            entity cannot be converted to a shape.
        :rtype: OCCT.AIS.AIS_Shape or None
        """
        if isinstance(entity, TopoDS_Shape):
            return self.view.display_shape(entity, rgb, transparency, material)
        elif isinstance(entity, (gp_Pnt, Geom_Curve, Geom_Surface)):
            return self.view.display_geom(entity, rgb, transparency, material)
        elif isinstance(entity, SMESH_Mesh):
            return self.view.display_mesh(entity, mode)
        else:
            return None

    def clear(self):
        """
        Clear contents of the view.

        :return: None.
        """

        self.view.remove_all()

    def start(self, fit=True):
        """
        Start the viewer.

        :param bool fit: Option to fit contents.

        :return: None.
        """

        if fit:
            self.view.fit()
        self._app.exec_()
Пример #31
0
                               QtCore.SIGNAL("clicked()"), start)
        QtCore.QObject.connect(self.ui.pushButton_stop,
                               QtCore.SIGNAL("clicked()"), stop)
        QtCore.QObject.connect(self.ui.lineEdit_logfilename,
                               QtCore.SIGNAL("textEdited(QString)"),
                               change_logfile)
        QtCore.QObject.connect(self.ui.checkBox_logdata,
                               QtCore.SIGNAL("stateChanged(int)"), toggle_log)

        #generate device tree
        for i, x in enumerate(dlt.dev):
            self.ui.devtree.topLevelItem(i).setText(
                0,
                QtWidgets.QApplication.translate("MainWindow", dlt.dev[i].name,
                                                 None, -1))
            self.ui.devtree.topLevelItem(i).setText(
                1,
                QtWidgets.QApplication.translate("MainWindow",
                                                 dlt.dev[i].status, None, -1))


if __name__ == "__main__":
    app = QApplication([])
    window = MainWindow()
    window.show()
    startup()
    # Stars the control program
    #th.Thread(target=builduidevices)
    # app.exec_() runs Qt mainloop
    sys.exit(app.exec_())
    input()
Пример #32
0
    qml_imports_dir_path = os.path.abspath(
        os.path.join(current_dir_path, "QmlImports"))
    examples_dir_url = str(
        QUrl.fromLocalFile(os.path.join(installation_path,
                                        'Examples')).toString())
    examples_rc_dir_url = str(
        QUrl.fromLocalFile(
            os.path.join(current_dir_path, "Resources",
                         "Examples")).toString())
    examples_rc_dir_path = os.path.abspath(
        os.path.join(current_dir_path, "Resources", "Examples"))
    #print("examples_rc_dir_url", examples_rc_dir_url)
    #print("examples_rc_dir_path", examples_rc_dir_path)

    # Create an application
    app = QApplication(sys.argv)

    app.setOrganizationName("easyDiffraction")
    app.setOrganizationDomain("easyDiffraction.org")
    app.setApplicationName("easyDiffraction")
    app.setWindowIcon(QIcon(window_icon_path))

    # Create a proxy object between python logic and QML GUI
    proxy_py_qml_obj = ProxyPyQml(release_config_file_path)

    # Create GUI from QML
    engine = QQmlApplicationEngine()

    engine.rootContext().setContextProperty("_loggerPyQml", logger_py_qml)
    engine.rootContext().setContextProperty("proxyPyQmlObj", proxy_py_qml_obj)
    engine.rootContext().setContextProperty("examplesDirUrl", examples_dir_url)
Пример #33
0
 def switchLayoutDirection(self):
     if self.layoutDirection() == Qt.LeftToRight:
         QApplication.setLayoutDirection(Qt.RightToLeft)
     else:
         QApplication.setLayoutDirection(Qt.LeftToRight)
Пример #34
0
        if len(self.charts):
            chart = self.charts[0].chart()
            animation_options = chart.animationOptions()
            if animation_options != options:
                for chart_view in self.charts:
                    chart_view.chart().setAnimationOptions(options)

        # Update legend alignment
        idx = self.ui.legendComboBox.currentIndex()
        alignment = self.ui.legendComboBox.itemData(idx)

        if not alignment:
            for chart_view in self.charts:
                chart_view.chart().legend().hide()
        else:
            for chart_view in self.charts:
                chart_view.chart().legend().setAlignment(alignment)
                chart_view.chart().legend().show()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = QMainWindow()
    widget = ThemeWidget(None)
    window.setCentralWidget(widget)
    available_geometry = app.desktop().availableGeometry(window)
    size = available_geometry.height() * 0.9
    window.setFixedSize(size, size * 0.9)
    window.show()
    sys.exit(app.exec_())
Пример #35
0
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

    def accept(self):
        if not self.selected_atoms:
            msg = 'Please select at least one element'
            QMessageBox.critical(self, 'HEXRD', msg)
            return

        super().accept()

    @property
    def selected_atoms(self):
        return [x.symbol for x in self.periodic_table.getSelection()]

    def clear_selection(self):
        for item in self.periodic_table.getSelection():
            self.periodic_table.elementToggle(item)


if __name__ == '__main__':
    from PySide2.QtWidgets import QApplication

    app = QApplication()

    dialog = PeriodicTableDialog(['H', 'Ni', 'Ta'])
    dialog.exec_()

    print(f'{dialog.selected_atoms=}')
Пример #36
0
 def setUp(self):
     QApplication()
Пример #37
0
            self.m_audioOutput.suspend()
            self.m_suspendResumeButton.setText(self.RESUME_LABEL)
        elif self.m_audioOutput.state() == QAudio.StoppedState:
            qWarning("status: Stopped, resume()")
            self.m_audioOutput.resume()
            self.m_suspendResumeButton.setText(self.SUSPEND_LABEL)
        elif self.m_audioOutput.state() == QAudio.IdleState:
            qWarning("status: IdleState")

    stateMap = {
        QAudio.ActiveState: "ActiveState",
        QAudio.SuspendedState: "SuspendedState",
        QAudio.StoppedState: "StoppedState",
        QAudio.IdleState: "IdleState"}

    def handleStateChanged(self, state):
        qWarning("state = " + self.stateMap.get(state, "Unknown"))


if __name__ == '__main__':

    import sys

    app = QApplication(sys.argv)
    app.setApplicationName("Audio Output Test")

    audio = AudioTest()
    audio.show()

    sys.exit(app.exec_())
import sys
from PySide2.QtWidgets import QApplication
from PySide2.QtGui import QIcon

app = QApplication(sys.argv)
app.setStyle("Fusion")
app.setWindowIcon(QIcon("snwa_logo_icon.ico"))
Пример #39
0
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        self.create_widgets()

    def create_widgets(self):
        vbox = QVBoxLayout()
        self.setLayout(vbox)

        for n in range(1, 5):
            button = QPushButton(f'Button {n}')
            vbox.addWidget(button)


if __name__ == "__main__":
    import sys

    app = QApplication([])

    screen_size = app.desktop().geometry()
    # screen_size = app.primaryScreen().geometry()

    mainwindow = MainWindow(screen_size=screen_size)
    mainwindow.show()
    sys.exit(app.exec_())
Пример #40
0

class SerialProgramLoader(QMainWindow):
    def __init__(self):
        super(SerialProgramLoader, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.loaderFrameLayout = QVBoxLayout(self.ui.loaderFrame)
        self.ui.loaderFrameLayout.setMargin(0)
        self.ui.loaderFrame.setLayout(self.ui.loaderFrameLayout)
        self.ui.loader = Loader(self)
        self.ui.loaderFrameLayout.addWidget(self.ui.loader)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setApplicationName('Serial Program Loader')
    app.setApplicationVersion('0.0.0')
    parser = QCommandLineParser()
    parser.setApplicationDescription(
        'Program to send Machining routines to CNC machines via serial port')
    startFullScreen = QCommandLineOption(('f', 'fullscreen'),
                                         "Start in fullscreen mode")
    parser.addOption(startFullScreen)
    parser.addHelpOption()
    parser.addVersionOption()
    parser.process(app)
    globalSettings = QSettings('settings.ini', QSettings.IniFormat)
    window = SerialProgramLoader()
    if parser.isSet(startFullScreen):
        window.showFullScreen()
Пример #41
0
 def paintEvent(self, e):
     p = QPainter(self)
     style = QApplication.style()
     option = QStyleOptionButton()
     style.drawControl(QStyle.CE_PushButton, option, p)
     self._painted = True
 def testQPushButton(self):
     #QApplication deleted before QPushButton
     a = QApplication([])
     b = QPushButton('aaaa')
     del a
Пример #43
0
__long_description__ = QApplication.instance().translate(
    "filters_editor", """
<p>This plugin is used to filter (show/hide) the variants displayed in the main window.</p>

<p>Start by clicking on the <em>"+"</em> button (Add Condition), an example is displayed.</p>

A filter is composed of 2 types of elements:

<ul>
<li><b>Logical/Boolean operators</b> (<em>OR/AND</em>) containing sub-filters.</li>
<li><b>Sub-filters</b> each applying to a field available in Cutevariant.</li>
</ul>

The conditions represent the most important part of a filter, they are composed of
of 3 interactive fields:

<ul>
<li>the <b>field</b> available for filtering on which the filter will be applied;</li>
<li>the <b>comparison operator</b> to keep or exclude variants;</li>
<li>the <b>value</b> of the field that will be compared to the value in the database.</li>
</ul>

<p>It is possible to work with several values with the operators <em>IN/NOT IN</em> by
separating values with commas, or by using wordsets managed with the <em>WordSets plugin</em>.</p>

Example of syntax:

<ul>
<li><em>gene in my_gene1, my_gene2</em>: Only the 'my_gene1' or 'my_gene2' genes</li>
<li><em>gene in WORDSET, my_word_set</em>: All genes contained in the wordset 'my_word_set'</li>
<li><em>gene in WORDSET ['my_word_set']</em>: idem </li>
<li><em>gene LIKE "C%"</em>: All genes whose name begins with 'C'</li>
<li><em>chr in ('10', 'X')</em>: Only chromosomes 10 or X</li>
<li><em>chr not in 10, 11</em>: The chromosomes other than 10 and 11</li>
</ul>

<p>You can delete or save a filter to retrieve it later by clicking on the "save"
or "delete" buttons.</p>

<br><br><br>
Additional information:

<ul>
<li>the result of a filter can be saved as a selection by clicking on the save
button on the main window;</li>
<li>you can temporarily hide an item by clicking on the "eye" icon;</li>
<li>each item can be removed by clicking on the cross button on its right;</li>
<li>you can work with several logical operators to form complex filters;</li>
To do so, simply right-click on the first item of your filter (<em>AND</em>
by default) and select "Add condition";</li>
<li>each subcondition can be dragged and dropped from one logical group to another.</li>
</ul>
""")
Пример #44
0
def main():
    app = QApplication(sys.argv)
    app.setApplicationName("Jilebi")
    control = Control()
    control.show()
    sys.exit(app.exec_())
Пример #45
0
 def testNoFocusWindow(self):
     widget = QApplication.focusWidget()
     self.assertTrue(widget == None)
Пример #46
0
def run():
    app = QApplication(sys.argv)
    loc = path.dirname(__file__)
    form = Form(loc + '\\' + "summary_tool.ui", app)
    sys.exit(app.exec_())
Пример #47
0
 def testCase(self):
     w = MyWidget()
     widgets = QApplication.allWidgets()
     self.assert_(w in widgets)
Пример #48
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)
        self.set_settings()
        self.create_widgets()

    def set_settings(self):
        self.resize(350, 200)

    def create_widgets(self):
        self.progress_bar = QProgressBar(self)
        self.progress_bar.setFixedWidth(300)
        self.progress_bar.move(50, 80)

        # Timer creating
        self.timer = QBasicTimer()
        self.step = 0
        self.timer.start(100, self)

    def timerEvent(self, e):
        if self.step >= 100:
            self.timer.stop()
        self.step += 1
        self.progress_bar.setValue(self.step)


if __name__ == "__main__":
    root = QApplication(sys.argv)
    app = Window()
    app.show()
    sys.exit(root.exec_())
Пример #49
0
def main():
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
Пример #50
0
 def setUpClass(cls):
     if not QApplication.instance():
         QApplication()
Пример #51
0
            else:
                # got a filename
                fullname = os.path.join(self.directory, file)
                if os.path.isdir(fullname) and not os.path.islink(fullname):
                    self.stack.append(fullname)
                if fnmatch.fnmatch(file, self.pattern):
                    return fullname

class MouseEventFilter(QtCore.QObject):
    def eventFilter(self, obj, event):
        if event.type() == QtCore.QEvent.GraphicsSceneMousePress:
            #print("Mouse Click observed")
            return True
        return False                


if __name__ == "__main__":
    app = QApplication(sys.argv)
    #print("script location =", os.path.dirname(os.path.realpath(sys.argv[0])))
    #print("help location =", os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "instructions.png"))
    screen = app.primaryScreen()
    size = screen.size()
    rect = screen.availableGeometry()
    #print("Screen size =", size.width(), "X", size.height())
    #print("Available screen size =", rect.width(), "X", rect.height())
    pix_ratio = screen.devicePixelRatio()
    currentPath = os.getcwd()
    
    myapp = MyForm(size.width(), size.height(), pix_ratio, currentPath)
    myapp.show()
    sys.exit(app.exec_())
Пример #52
0
 def connect_signals_and_slots(self):
     self.actionExit.triggered.connect(QApplication.instance().quit)
     self.actionAbout.triggered.connect(self.showAboutWindow)
     self.langGroup.triggered.connect(self.onLanguageChanged)
     self.statementGroup.triggered.connect(self.statements.load)
     self.actionReconcile.triggered.connect(
         self.reconcileAtCurrentOperation)
     self.action_Load_quotes.triggered.connect(
         partial(self.downloader.showQuoteDownloadDialog, self))
     self.actionImportSlipRU.triggered.connect(self.importSlip)
     self.actionBackup.triggered.connect(self.backup.create)
     self.actionRestore.triggered.connect(self.backup.restore)
     self.action_Re_build_Ledger.triggered.connect(
         partial(self.ledger.showRebuildDialog, self))
     self.actionAccountTypes.triggered.connect(
         partial(self.onDataDialog, "account_types"))
     self.actionAccounts.triggered.connect(
         partial(self.onDataDialog, "accounts"))
     self.actionAssets.triggered.connect(
         partial(self.onDataDialog, "assets"))
     self.actionPeers.triggered.connect(partial(self.onDataDialog,
                                                "agents"))
     self.actionCategories.triggered.connect(
         partial(self.onDataDialog, "categories"))
     self.actionTags.triggered.connect(partial(self.onDataDialog, "tags"))
     self.actionCountries.triggered.connect(
         partial(self.onDataDialog, "countries"))
     self.actionQuotes.triggered.connect(
         partial(self.onDataDialog, "quotes"))
     self.PrepareTaxForms.triggered.connect(
         partial(self.taxes.showTaxesDialog, self))
     self.BalanceDate.dateChanged.connect(
         self.BalancesTableView.model().setDate)
     self.HoldingsDate.dateChanged.connect(
         self.HoldingsTableView.model().setDate)
     self.BalancesCurrencyCombo.changed.connect(
         self.BalancesTableView.model().setCurrency)
     self.BalancesTableView.doubleClicked.connect(self.OnBalanceDoubleClick)
     self.HoldingsCurrencyCombo.changed.connect(
         self.HoldingsTableView.model().setCurrency)
     self.ReportRangeCombo.currentIndexChanged.connect(
         self.onReportRangeChange)
     self.RunReportBtn.clicked.connect(self.onRunReport)
     self.SaveReportBtn.clicked.connect(self.reports.saveReport)
     self.ShowInactiveCheckBox.stateChanged.connect(
         self.BalancesTableView.model().toggleActive)
     self.DateRangeCombo.currentIndexChanged.connect(
         self.OnOperationsRangeChange)
     self.ChooseAccountBtn.changed.connect(
         self.OperationsTableView.model().setAccount)
     self.SearchString.textChanged.connect(
         self.OperationsTableView.model().filterText)
     self.HoldingsTableView.customContextMenuRequested.connect(
         self.onHoldingsContextMenu)
     self.OperationsTableView.selectionModel().selectionChanged.connect(
         self.OnOperationChange)
     self.OperationsTableView.customContextMenuRequested.connect(
         self.onOperationContextMenu)
     self.DeleteOperationBtn.clicked.connect(self.deleteOperation)
     self.actionDelete.triggered.connect(self.deleteOperation)
     self.CopyOperationBtn.clicked.connect(self.copyOperation)
     self.actionCopy.triggered.connect(self.copyOperation)
     self.downloader.download_completed.connect(self.balances_model.update)
     self.downloader.download_completed.connect(self.holdings_model.update)
     self.statements.load_completed.connect(self.ledger.rebuild)
     self.ledger.updated.connect(self.balances_model.update)
     self.ledger.updated.connect(self.holdings_model.update)
Пример #53
0
import sys
import math
import numpy
import ctypes
from PySide2.QtCore import QCoreApplication, Signal, SIGNAL, SLOT, Qt, QSize, QPoint
from PySide2.QtGui import (QVector3D, QOpenGLFunctions, QOpenGLVertexArrayObject, QOpenGLBuffer,
    QOpenGLShaderProgram, QMatrix4x4, QOpenGLShader, QOpenGLContext, QSurfaceFormat)
from PySide2.QtWidgets import (QApplication, QWidget, QMessageBox, QHBoxLayout, QSlider,
    QOpenGLWidget)
from PySide2.shiboken2 import VoidPtr

try:
    from OpenGL import GL
except ImportError:
    app = QApplication(sys.argv)
    messageBox = QMessageBox(QMessageBox.Critical, "OpenGL hellogl",
                                         "PyOpenGL must be installed to run this example.",
                                         QMessageBox.Close)
    messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
    messageBox.exec_()
    sys.exit(1)


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

        self.glWidget = GLWidget()

        self.xSlider = self.createSlider(SIGNAL("xRotationChanged(int)"),
Пример #54
0
        QWidget.__init__(self)
        self.layout = QHBoxLayout()
        self.setLayout(self.layout)

        self.label = QLabel(text)
        self.line_edit = QLineEdit()

        self.layout.addWidget(self.label)
        self.layout.addWidget(self.line_edit)


class ConfigurationDialog(QDialog):
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle('Configuration')
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        labeledtextfields = [
            LabeledTextField('IP address'),
            LabeledTextField('User'),
            LabeledTextField('Password')
        ]
        for labeledtextfield in labeledtextfields:
            self.layout.addWidget(labeledtextfield)


if __name__ == '__main__':
    app = QApplication([])
    win = ConfigurationDialog()
    win.show()
    app.exec_()
Пример #55
0
    def collapse(self, full_rows: list):
        for row in reversed(sorted(full_rows)):
            for column in range(self.num_columns):
                self[row, column].collapse()

    def shift(self, full_rows: list):
        for row in reversed(range(min(full_rows))):
            for column in range(self.num_columns):
                if self[row, column] is not None:
                    self[row, column].shift(len(full_rows))

    def restart(self):
        for tile in filter(lambda tl: tl is not None, self):
            tile.disappear()
        self.clear()
        self.update({(row, column): None for row in range(self.num_rows) for column in range(self.num_columns)})
        self.score = 0
        self.delegate.scored(self.score)
        self.spawn()


if __name__ == '__main__':
    from PySide2.QtWidgets import QApplication
    import sys
    import ui

    application = QApplication(sys.argv)
    qTetris = ui.QTetris()
    sys.exit(application.exec_())
Пример #56
0
        new.triggered.connect(self.newSlot)
        file.addAction(new)
        cascade = QAction("Cascade", self)
        cascade.triggered.connect(self.cascadeAction)
        file.addAction(cascade)
        tiled = QAction("Tiled", self)
        tiled.triggered.connect(self.tileAction)
        file.addAction(tiled)
        self.count = 0

    def newSlot(self):
        self.count += 1
        sub = QMdiSubWindow()
        sub.setWidget(QTextEdit())
        sub.setWindowTitle("Sub Window " + str(self.count))
        self.mdi.addSubWindow(sub)
        sub.show()

    def cascadeAction(self):
        self.mdi.cascadeSubWindows()

    def tileAction(self):
        self.mdi.tileSubWindows()


myApp = QApplication(sys.argv)
window = Window()
window.show()

myApp.exec_()
sys.exit(0)
Пример #57
0
global excredi1
global cciuser1
global montotpre1
global indforwid1
global verdmontot1
global usercompar1
verdmontot1=int(0)
indforwid1=str(None)
montotpre1=0
usercompar1 = None

#userlog1=str('Master')
#passw1=str('master6969')

QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_ShareOpenGLContexts)
app = QApplication(sys.argv)
loginfile = QFile("iniciosesion.ui")
loginfile.open(QFile.ReadOnly)
loader = QUiLoader()
loginwindow = loader.load(loginfile)
USqline1 = loginwindow.findChild(QLineEdit, 'Usuarioline1')
PSqline1 = loginwindow.findChild(QLineEdit, 'passw1')
alerforlog1=loginwindow.findChild(QLabel, 'aviso1')
btn_brow_1 = loginwindow.findChild(QPushButton, 'inisesbut1')
loginwindow.show()
#####     Ventana de Ventas
venfile1 = QFile("ventaventana.ui")
venfile1.open(QFile.ReadOnly)
loader2 = QUiLoader()
venwindow2 = loader2.load(venfile1)
nomqline2 = venwindow2.findChild(QLineEdit, 'busnom1')
Пример #58
0
        id = dbu.Database().getPlayerId(self.name, self.games, self.wins)[0][0]

        dbu.Database().updateAll(id, self.txtPlayerName.toPlainText(),
                                 str(gender),
                                 int(self.txtPlayerGames.toPlainText()),
                                 int(self.txtPlayerWins.toPlainText()),
                                 int(self.txtPlayedRounds.toPlainText()))

        self.hide()
        self.playerList.btnAddPlayer.show()
        self.playerList.btnEditPlayer.show()
        self.playerList.browser.show()
        self.playerList.btnRemovePlayer.show()
        self.playerList.mainWindow.btnBack.show()
        self.playerList.mainWindow.btnStartGame.show()

        self.playerList.setMaximumSize(600, 800)

        self.playerList.browser.refreshView()


if __name__ == '__main__':

    from PySide2.QtWidgets import QApplication
    import sys

    app = QApplication(sys.argv)
    window = AddPlayer()
    window.show()
    app.exec_()
Пример #59
0
    def flags(self, index):
        """ Set the item flags at the given index. Seems like we're 
            implementing this function just to see how it's done, as we 
            manually adjust each tableView to have NoEditTriggers.
        """
        if not index.isValid():
            return Qt.ItemIsEnabled
        return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
Qt.ItemIsEditable)



if __name__ == '__main__':
    # Create the Qt Application
    app = QApplication(sys.argv)

    #get all ip adresses in the lan
    host_list = get_neighbors()
    print(host_list)

    col_getter = [  {"Name": "Dev", "Getter": lambda aHostItem: aHostItem["dev"]},
                    {"Name": "Ip", "Getter": lambda aHostItem: aHostItem["ip"]},
                    {"Name": "Mac", "Getter": lambda aHostItem: aHostItem["mac"]}, ]


    host_table = QTableView()
    host_model = HostModel(host_list, col_getter, host_table)
    host_table.setModel(host_model)
    host_table.show()
Пример #60
0
import sys
import argparse
from PySide2.QtCore import (Qt, QPointF)
from PySide2.QtGui import (QColor, QPainter, QPainterPath, QImage,
                           )
from PySide2.QtWidgets import (QApplication, QMainWindow)
from PySide2.QtCharts import QtCharts
import math

import ddv.csv


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

    data = ddv.csv.getScatterChartData("nba_player_data.csv")
    
    chart = QtCharts.QChart()
    
    
    series0 = QtCharts.QScatterSeries()
    series0.setName("height / weight")
    series0.setMarkerShape(QtCharts.QScatterSeries.MarkerShapeCircle)
    series0.setMarkerSize(5.0)    

    #series0.append([0, 6, 6, 4])

    pointsList = list(map(lambda hw: QPointF(hw[0], hw[1]),
                     zip(data[0], data[1])))

    series0.append(pointsList)