def main(): """ Main """ # Process command-line arguments filename = None for arg in sys.argv[1:]: if arg in ('-h', '--help'): print(__doc__) sys.exit(0) filename = arg # Start up the QApplication app = QApplication([]) from minibar.gui import mbWidgetStyling mbWidgetStyling.styleTheApplication() window = PartEdit() # Open file if provided if filename: window.open(filename) window.show() # Configure ctrl-q to quit QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q), window, window.close) # Go app.exec_()
def main(): """ Main """ # Process command-line arguments filename = None for arg in sys.argv[1:]: if arg in ('-h', '--help'): print __doc__ sys.exit(0) filename = arg # Start up the QApplication app = QApplication([]) from minibar.gui import mbWidgetStyling mbWidgetStyling.styleTheApplication() window = PartEdit() # Open file if provided if filename: window.open(filename) window.show() # Configure ctrl-q to quit QShortcut( QKeySequence(Qt.CTRL + Qt.Key_Q), window, window.close ) # Go app.exec_()
def main(): app = QApplication([]) Col = MainWindow.MainController() runAnimation() Col.view.showMaximized() app.exec_()
def _doit(factory): try: app = QApplication([]) except RuntimeError: app = QCoreApplication.instance() main_window = factory() if getattr(sys, '_called_from_test', False) and is_windows_platform(): QTimer.singleShot(500, app, Slot('quit()')) main_window.show() app.exec_()
def application(): app = QApplication.instance() if not app: app = QApplication(sys.argv) yield app app.exec_() else: yield app if dcc.is_standalone(): app.exec_()
def _doit(factory): # for windows these needs to be repeated due to multiprocessing (?) from Qt.QtWidgets import QApplication from Qt.QtCore import QCoreApplication try: app = QApplication([]) except RuntimeError: app = QCoreApplication.instance() main_window = factory() if getattr(sys, '_called_from_test', False) and (is_windows_platform() or is_macos_platform()): QTimer.singleShot(1000, app.quit) main_window.show() app.exec_()
def main(): """ Data visualisation and analysis tool in Python, intended to be familiar to users of XPAD. Primarily for IDAM data from the MAST tokamak experiment, but can be used to view NetCDF files currently. """ # Add command line arguments parser = argparse.ArgumentParser(description=main.__doc__) parser.add_argument("-c", "--config", nargs=1, help="Config file to load", default=None) parser.add_argument( "-i", "--ignore-config", help="Ignore existing config files", action="store_true", default=False, ) parser.add_argument("-v", "--version", action="version", version="%(prog)s {}".format(version)) args = parser.parse_args() loadfile = args.config[0] if args.config is not None else None app = QApplication(sys.argv) window = PyXPad(loadfile=loadfile, ignoreconfig=args.ignore_config) window.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) dialog = Dialog() dialog.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) layout = QVBoxLayout() infos = QSerialPortInfo.availablePorts() for info in infos: s = ( f"Port: {info.portName()}", f"Location: {info.systemLocation()}", f"Description: {info.description()}", f"Manufacturer: {info.manufacturer()}", f"Serial number: {info.serialNumber()}", "Vendor Identifier: " + f"{info.vendorIdentifier():x}" if info.hasVendorIdentifier() else "", "Product Identifier: " + f"{info.productIdentifier():x}" if info.hasProductIdentifier() else "", ) label = QLabel("\n".join(s)) layout.addWidget(label) workPage = QWidget() workPage.setLayout(layout) area = QScrollArea() area.setWindowTitle("Info about all available serial ports.") area.setWidget(workPage) area.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_())
def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) # QtWebEngine::initialize() if QT_NO_WIDGETS: app = QApplication(sys.argv) else: app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() server = Server(engine) engine.load(QUrl("qrc:/main.qml")) QTimer.singleShot(0, server.run) proxy = QNetworkProxy() proxy.setType(QNetworkProxy.HttpProxy) proxy.setHostName("localhost") proxy.setPort(5555) QNetworkProxy.setApplicationProxy(proxy) sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) server = Server() QGuiApplication.setApplicationDisplayName( server.tr("Local Fortune Server")) server.show() sys.exit(app.exec_())
def main(): """Entry point""" # Just starting the app returns in a sigsegv on close :/ app = QApplication(sys.argv) #label = QLabel("<font color=red size=40>Hello World</font>") #label.show() editor = Editor() editor.show() res = app.exec_()
def main(): import sys app = QApplication(sys.argv) client = Client() QGuiApplication.setApplicationDisplayName( client.tr("Local Fortune Client")) client.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) w = View() w.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) QQuickWindow.setDefaultAlphaBuffer(True) QCoreApplication.setApplicationName("Photosurface") QCoreApplication.setOrganizationName("QtProject") QCoreApplication.setApplicationVersion(__qt_version__) parser = QCommandLineParser() parser.setApplicationDescription("Qt Quick Demo - Photo Surface") parser.addHelpOption() parser.addVersionOption() parser.addPositionalArgument("directory", "The image directory or URL to show.") parser.process(app) initialUrl = QUrl() if parser.positionalArguments(): initialUrl = QUrl.fromUserInput( parser.positionalArguments()[0], QDir.currentPath(), QUrl.AssumeLocalFile ) if not initialUrl.isValid(): print( 'Invalid argument: "', parser.positionalArguments()[0], '": ', initialUrl.errorString(), ) sys.exit(1) nameFilters = imageNameFilters() engine = QQmlApplicationEngine() context: QQmlContext = engine.rootContext() picturesLocationUrl = QUrl.fromLocalFile(QDir.homePath()) picturesLocations = QStandardPaths.standardLocations( QStandardPaths.PicturesLocation ) if picturesLocations: picturesLocationUrl = QUrl.fromLocalFile(picturesLocations[0]) if not initialUrl and QDir(picturesLocations[0]).entryInfoList( nameFilters, QDir.Files ): initialUrl = picturesLocationUrl context.setContextProperty("contextPicturesLocation", picturesLocationUrl) context.setContextProperty("contextInitialUrl", initialUrl) context.setContextProperty("contextImageNameFilters", nameFilters) engine.load(QUrl("qrc:///photosurface.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) if not createConnection(): sys.exit(-1) editor = TableEditor("person") editor.show() sys.exit(app.exec_())
def main() -> None: import sys app = QApplication(sys.argv) app.setApplicationName("Audio Device Test") audio = AudioTest() audio.show() sys.exit(app.exec_())
def main(): import sys QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) engine = QQmlApplicationEngine() engine.addImportPath(":/imports") engine.load(QUrl("qrc:/flatstyle.qml")) sys.exit(app.exec_())
def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) app.setApplicationName("LightMaps") w = MapZoom() w.resize(600, 450) w.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) if not createConnection(): sys.exit(-1) view = View("items", "images") view.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) acmeSeries = QBoxPlotSeries() acmeSeries.setName("Acme Ltd") boxWhiskSeries = QBoxPlotSeries() boxWhiskSeries.setName("BoxWhisk Inc") acmeData = QFile(":acme") if not acmeData.open(QIODevice.ReadOnly | QIODevice.Text): sys.exit(1) dataReader = BoxDataReader(acmeData) while not dataReader.atEnd(): _set = dataReader.readBox() if _set is not None: acmeSeries.append(_set) boxwhiskData = QFile(":boxwhisk") if not boxwhiskData.open(QIODevice.ReadOnly | QIODevice.Text): sys.exit(1) dataReader.readFile(boxwhiskData) while not dataReader.atEnd(): _set = dataReader.readBox() if _set is not None: boxWhiskSeries.append(_set) chart = QChart() chart.addSeries(acmeSeries) chart.addSeries(boxWhiskSeries) chart.setTitle("Acme Ltd and BoxWhisk Inc share deviation in 2012") chart.setAnimationOptions(QChart.SeriesAnimations) chart.createDefaultAxes() chart.axes(Qt.Vertical)[0].setMin(15.0) chart.axes(Qt.Vertical)[0].setMax(34.0) chart.legend().setVisible(True) chart.legend().setAlignment(Qt.AlignBottom) chartView = QChartView(chart) chartView.setRenderHint(QPainter.Antialiasing) window = QMainWindow() window.setCentralWidget(chartView) window.resize(800, 600) window.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) instance = PyFlow.instance(software="standalone") if instance is not None: app.setActiveWindow(instance) instance.show() try: sys.exit(app.exec_()) except Exception as e: print(e)
def main(): import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) w = MainWindow(QUrl("http://qt.io")) w.resize(1024, 768) w.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) set0 = QBarSet("Jane") set1 = QBarSet("John") set2 = QBarSet("Axel") set3 = QBarSet("Mary") set4 = QBarSet("Samantha") set0 << 1 << 2 << 3 << 4 << 5 << 6 set1 << 5 << 0 << 0 << 4 << 0 << 7 set2 << 3 << 5 << 8 << 13 << 8 << 5 set3 << 5 << 6 << 7 << 3 << 4 << 5 set4 << 9 << 7 << 5 << 3 << 1 << 2 series = QBarSeries() series.append(set0) series.append(set1) series.append(set2) series.append(set3) series.append(set4) chart = QChart() chart.addSeries(series) chart.setTitle("Simple barchart example") chart.setAnimationOptions(QChart.SeriesAnimations) categories = ("Jan", "Feb", "Mar", "Apr", "May", "Jun") axisX = QBarCategoryAxis() axisX.append(categories) chart.addAxis(axisX, Qt.AlignBottom) series.attachAxis(axisX) axisY = QValueAxis() axisY.setRange(0, 15) chart.addAxis(axisY, Qt.AlignLeft) series.attachAxis(axisY) chart.legend().setVisible(True) chart.legend().setAlignment(Qt.AlignBottom) chartView = QChartView(chart) chartView.setRenderHint(QPainter.Antialiasing) window = QMainWindow() window.setCentralWidget(chartView) window.resize(420, 300) window.show() sys.exit(app.exec_())
def main() -> None: import sys QCoreApplication.setOrganizationName("QtExamples") QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) view = QWebEngineView() view.setUrl(commandLineUrlArgument()) view.resize(1024, 750) view.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) app.setApplicationName("style") app.setOrganizationName("QtProject") app.setOrganizationDomain("www.qt-project.org") widget = StyleWidget() widget.showFullScreen() sys.exit(app.exec_())
def main(): import sys a = QApplication(sys.argv) acmeSeries = QCandlestickSeries() acmeSeries.setName("Acme Ltd") acmeSeries.setIncreasingColor(QColor(Qt.green)) acmeSeries.setDecreasingColor(QColor(Qt.red)) acmeData = QFile(":acme") if not acmeData.open(QIODevice.ReadOnly | QIODevice.Text): sys.exit(1) categories = [] dataReader = CandlestickDataReader(acmeData) while not dataReader.atEnd(): _set = dataReader.readCandlestickSet() if _set is not None: acmeSeries.append(_set) categories.append( QDateTime.fromMSecsSinceEpoch(int( _set.timestamp())).toString("dd")) chart = QChart() chart.addSeries(acmeSeries) chart.setTitle("Acme Ltd Historical Data (July 2015)") chart.setAnimationOptions(QChart.SeriesAnimations) chart.createDefaultAxes() axisX = chart.axes(Qt.Horizontal)[0] axisX.setCategories(categories) axisY = chart.axes(Qt.Vertical)[0] axisY.setMax(axisY.max() * 1.01) axisY.setMin(axisY.min() * 0.99) chart.legend().setVisible(True) chart.legend().setAlignment(Qt.AlignBottom) chartView = QChartView(chart) chartView.setRenderHint(QPainter.Antialiasing) window = QMainWindow() window.setCentralWidget(chartView) window.resize(800, 600) window.show() sys.exit(a.exec_())
def main(): """ BOUT++ grid generation """ parser = argparse.ArgumentParser(description=main.__doc__) parser.add_argument("-v", "--version", action="version", version="%(prog)s {}".format(__version__)) parser.parse_args() app = QApplication(sys.argv) window = HypnotoadGui() window.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) input_device = QAudioDeviceInfo.defaultInputDevice() if input_device.isNull(): QMessageBox.warning(None, "audio", "There is no audio input device available.") sys.exit(-1) w = Widget(input_device) w.show() sys.exit(app.exec_())