本文整理汇总了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()
示例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)
示例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