def test_colordialog(): dlg = widgets.ColorDialog() assert str(dlg.current_color()) == str(gui.Color("white")) with open("data.pkl", "wb") as jar: pickle.dump(dlg, jar) with open("data.pkl", "rb") as jar: dlg = pickle.load(jar)
def choose_color(self): dlg = widgets.ColorDialog() if self.current_color: dlg.setCurrentColor(self.current_color) if dlg.exec_(): self.set_color(dlg.current_color()) self.value_changed.emit(dlg.current_color())
def choose_color(self): dlg = widgets.ColorDialog() if self._current_color: dlg.setCurrentColor(self._current_color) if dlg.main_loop(): new_color = dlg.current_color() self.set_current_color(new_color) self.value_changed.emit(new_color)
def test_sidebarwidget(qtbot): ex = custom_widgets.SidebarWidget(show_settings=True) page_1 = widgets.PlainTextEdit() page_2 = widgets.ColorDialog() page_3 = widgets.FileDialog() ex.add_tab(page_1, "Text", "mdi.timer") ex.add_tab(page_2, "Color", "mdi.format-color-fill", area="bottom") ex.add_tab(page_3, "Help", "mdi.help-circle-outline") ex.set_marker(page_3) ex.set_tab(page_2)
# callback=callback, # checkable=checkable) act = widgets.Action( text=title, icon=icon, shortcut=shortcut, checkable=checkable, callback=callback, ) if area == "top": self.sidebar.insertAction(self.spacer_action, act) if area == "bottom": self.sidebar.addAction(act) button = self.sidebar.widgetForAction(act) button.setFixedWidth(self.BUTTON_WIDTH) return act if __name__ == "__main__": app = widgets.app() ex = SidebarWidget(show_settings=True) page_1 = widgets.PlainTextEdit() page_2 = widgets.ColorDialog() page_3 = widgets.FileDialog() ex.add_tab(page_1, "Text", "mdi.timer") ex.add_tab(page_2, "Color", "mdi.format-color-fill", area="bottom") ex.add_tab(page_3, "Help", "mdi.help-circle-outline") ex.set_marker(page_3) ex.show() app.main_loop()
def test_colordialog(): dlg = widgets.ColorDialog() dlg.show() dlg.close()