當前位置: 首頁>>代碼示例>>Python>>正文


Python QObject.connect方法代碼示例

本文整理匯總了Python中spyderlib.qt.QtCore.QObject.connect方法的典型用法代碼示例。如果您正苦於以下問題:Python QObject.connect方法的具體用法?Python QObject.connect怎麽用?Python QObject.connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在spyderlib.qt.QtCore.QObject的用法示例。


在下文中一共展示了QObject.connect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: initialize_plugin

# 需要導入模塊: from spyderlib.qt.QtCore import QObject [as 別名]
# 或者: from spyderlib.qt.QtCore.QObject import connect [as 別名]
 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())
     self.create_toggle_view_action()
開發者ID:Poneyo,項目名稱:spyderlib,代碼行數:11,代碼來源:__init__.py

示例2: __init__

# 需要導入模塊: from spyderlib.qt.QtCore import QObject [as 別名]
# 或者: from spyderlib.qt.QtCore.QObject import connect [as 別名]
        def __init__(self, canvas, num):
            import matplotlib
            
            if backend_qt4.DEBUG:
                print 'FigureManagerQT.%s' % backend_qt4.fn_name()
            backend_qt4.FigureManagerBase.__init__(self, canvas, num)
            self.canvas = canvas
            
            self.window = FigureWindow()
            self.window.setWindowTitle("Figure %d" % num)
            self.window.setAttribute(Qt.WA_DeleteOnClose)

            import os.path as osp
            image = osp.join(matplotlib.rcParams['datapath'],
                             'images', 'matplotlib.png' )
            self.window.setWindowIcon(QIcon(image))
    
            # Give the keyboard focus to the figure instead of the manager
            self.canvas.setFocusPolicy(Qt.ClickFocus)
            self.canvas.setFocus()
    
            QObject.connect(self.window, SIGNAL('destroyed()'),
                            self._widgetclosed)
            self.window._destroying = False
    
            self.toolbar = self._get_toolbar(self.canvas, self.window)
            self.window.addToolBar(self.toolbar)
            QObject.connect(self.toolbar, SIGNAL("message"),
                    self.window.statusBar().showMessage)
    
            self.window.setCentralWidget(self.canvas)
    
            if matplotlib.is_interactive():
                self.window.show()
    
            # attach a show method to the figure for pylab ease of use
            self.canvas.figure.show = lambda *args: self.window.show()
    
            def notify_axes_change(fig):
                # This will be called whenever the current axes is changed
                if self.toolbar != None: self.toolbar.update()
            self.canvas.figure.add_axobserver(notify_axes_change)
開發者ID:jromang,項目名稱:retina-old,代碼行數:44,代碼來源:mpl_patch.py

示例3: create_toolbutton

# 需要導入模塊: from spyderlib.qt.QtCore import QObject [as 別名]
# 或者: from spyderlib.qt.QtCore.QObject import connect [as 別名]
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 is_text_string(icon):
            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
開發者ID:jromang,項目名稱:spyderlib,代碼行數:26,代碼來源:qthelpers.py


注:本文中的spyderlib.qt.QtCore.QObject.connect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。