Start a single window application with a form generated from a designer file. :param ui_filename: the full path of a file generated with QtDesigner. :param drivers: a driver object or a collection of drivers. :param qapp_or_args: arguments to be passed to QApplication.
(ui_filename, drivers, qapp_or_args=None)
| 277 | |
| 278 | |
| 279 | def start_gui(ui_filename, drivers, qapp_or_args=None): |
| 280 | """Start a single window application with a form generated from |
| 281 | a designer file. |
| 282 | |
| 283 | :param ui_filename: the full path of a file generated with QtDesigner. |
| 284 | :param drivers: a driver object or a collection of drivers. |
| 285 | :param qapp_or_args: arguments to be passed to QApplication. |
| 286 | """ |
| 287 | |
| 288 | if isinstance(qapp_or_args, QtGui.QApplication): |
| 289 | qapp = qapp_or_args |
| 290 | else: |
| 291 | qapp = QtGui.QApplication(qapp_or_args or ['']) |
| 292 | |
| 293 | main = QtGui.loadUi(ui_filename) |
| 294 | |
| 295 | if isinstance(drivers, Driver): |
| 296 | connect_driver(main, drivers) |
| 297 | else: |
| 298 | connect_setup(main, drivers) |
| 299 | |
| 300 | main.show() |
| 301 | if sys.platform.startswith('darwin'): |
| 302 | main.raise_() |
| 303 | qapp.exec_() |
nothing calls this directly
no test coverage detected