def initialize_plugin(self): """ Initialize plugin: connect signals, setup actions, ... """ self.plugin_actions = self.get_plugin_actions() QObject.connect(self, SIGNAL('show_message(QString,int)'), self.show_message) QObject.connect(self, SIGNAL('update_plugin_title()'), self.__update_plugin_title) if self.sig_option_changed is not None: self.sig_option_changed.connect(self.set_option) self.setWindowTitle(self.get_plugin_title())
def create_toolbutton(parent, text=None, shortcut=None, icon=None, tip=None, toggled=None, triggered=None, autoraise=True, text_beside_icon=False): """Create a QToolButton""" button = QToolButton(parent) if text is not None: button.setText(text) if icon is not None: if isinstance(icon, (str, unicode)): icon = get_icon(icon) button.setIcon(icon) if text is not None or tip is not None: button.setToolTip(text if tip is None else tip) if text_beside_icon: button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) button.setAutoRaise(autoraise) if triggered is not None: QObject.connect(button, SIGNAL('clicked()'), triggered) if toggled is not None: QObject.connect(button, SIGNAL("toggled(bool)"), toggled) button.setCheckable(True) if shortcut is not None: button.setShortcut(shortcut) return button
def __init__(self): QObject.__init__(self) self.dialogs = {}