def test_clicking_picker_button_opens_picker_window(self): QTest.mouseClick(self.controller.add_button, Qt.LeftButton) picker_window_open = False for widget in QApplication.topLevelWidgets(): if isinstance(widget, lyrical.LyricalPicker): picker_window_open = True self.assertTrue(picker_window_open)
def on_viewSearch_doubleClicked(self, index): # TODO: Permissions #if self._editable: source_index = self._proxy.mapToSource(index) record = self._model.get_record(source_index.row()) id = record.value(0) # getting main window reference main = [main for main in QApplication.topLevelWidgets() if isinstance(main, QMainWindow)][0] main.show_on_top(EditBookDock, param=id)
def setBaseColor(newcolor): StyleHelper.requestedBaseColor = newcolor color = QColor() color.setHsv(newcolor.hue(), newcolor.saturation() * 0.7, 64 + newcolor.value() / 3) if color.isValid() and color != StyleHelper.baseColor: StyleHelper.baseColor = color for w in QApplication.topLevelWidgets(): w.update()
def toggle_visibility(self, visible): main = [main for main in QApplication.topLevelWidgets() if isinstance(main, QMainWindow)][0] actionOrderProduct = main.actionSellProduct if visible: super(OrderProductDock, self).toggle_visibility(visible) actionOrderProduct.setEnabled(False) self._addForm.edProductName.setFocus() else: actionOrderProduct.setEnabled(True)
def __init__(self, parent=None): super(Notification, self).__init__(parent) self.form = Ui_Form() self.form.setupUi(self) self.paddingLeft = 0 self.paddingBottom = 25 # op=QGraphicsOpacityEffect(self) # op.setOpacity(1.00) # self.setGraphicsEffect(op) self.setAutoFillBackground(True) self.topnotification_object_count = 0 self.bottomnotification_object_count = 0 self.new_topnotification_object = {} self.new_bottomnotification_object = {} self.add_new_topnotification() widgets = QApplication.topLevelWidgets() mainwindow, = [i for i in widgets if type(i).__name__ == 'QMainWindow'] windows = { type(i).__name__: i for i in mainwindow.centralWidget().children() } self.stack = windows['QStackedWidget'] self.form.part_two() self.form.show_all.clicked.connect(self.goto_notifications)
def tearDown(self): "Close the top-level window that was created in main()" for w in filter(lambda o: isinstance(o, MainWindow), QApplication.topLevelWidgets()): w.close()