本文整理汇总了Python中PyQt4.Qt.QToolBar.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Python QToolBar.isVisible方法的具体用法?Python QToolBar.isVisible怎么用?Python QToolBar.isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QToolBar
的用法示例。
在下文中一共展示了QToolBar.isVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Editor
# 需要导入模块: from PyQt4.Qt import QToolBar [as 别名]
# 或者: from PyQt4.Qt.QToolBar import isVisible [as 别名]
#.........这里部分代码省略.........
self.toolbar1.addAction(self.editor.action_undo)
self.toolbar1.addAction(self.editor.action_redo)
self.toolbar1.addAction(self.editor.action_select_all)
self.toolbar1.addAction(self.editor.action_remove_format)
self.toolbar1.addAction(self.editor.action_clear)
self.toolbar1.addSeparator()
for x in ('copy', 'cut', 'paste'):
ac = getattr(self.editor, 'action_'+x)
self.toolbar1.addAction(ac)
self.toolbar1.addSeparator()
self.toolbar1.addAction(self.editor.action_background)
# }}}
# toolbar2 {{{
for x in ('', 'un'):
ac = getattr(self.editor, 'action_%sordered_list'%x)
self.toolbar2.addAction(ac)
self.toolbar2.addSeparator()
for x in ('superscript', 'subscript', 'indent', 'outdent'):
self.toolbar2.addAction(getattr(self.editor, 'action_' + x))
if x in ('subscript', 'outdent'):
self.toolbar2.addSeparator()
self.toolbar2.addAction(self.editor.action_block_style)
w = self.toolbar2.widgetForAction(self.editor.action_block_style)
w.setPopupMode(w.InstantPopup)
self.toolbar2.addAction(self.editor.action_insert_link)
# }}}
# toolbar3 {{{
for x in ('bold', 'italic', 'underline', 'strikethrough'):
ac = getattr(self.editor, 'action_'+x)
self.toolbar3.addAction(ac)
self.toolbar3.addSeparator()
for x in ('left', 'center', 'right', 'justified'):
ac = getattr(self.editor, 'action_align_'+x)
self.toolbar3.addAction(ac)
self.toolbar3.addSeparator()
self.toolbar3.addAction(self.editor.action_color)
# }}}
self.code_edit.textChanged.connect(self.code_dirtied)
self.editor.page().contentsChanged.connect(self.wyswyg_dirtied)
def set_minimum_height_for_editor(self, val):
self.editor.setMinimumHeight(val)
@dynamic_property
def html(self):
def fset(self, v):
self.editor.html = v
def fget(self):
self.tabs.setCurrentIndex(0)
return self.editor.html
return property(fget=fget, fset=fset)
def change_tab(self, index):
# print 'reloading:', (index and self.wyswyg_dirty) or (not index and
# self.source_dirty)
if index == 1: # changing to code view
if self.wyswyg_dirty:
self.code_edit.setPlainText(self.editor.html)
self.wyswyg_dirty = False
elif index == 0: # changing to wyswyg
if self.source_dirty:
self.editor.html = unicode(self.code_edit.toPlainText())
self.source_dirty = False
def wyswyg_dirtied(self, *args):
self.wyswyg_dirty = True
def code_dirtied(self, *args):
self.source_dirty = True
def hide_toolbars(self):
self.toolbar1.setVisible(False)
self.toolbar2.setVisible(False)
self.toolbar3.setVisible(False)
def show_toolbars(self):
self.toolbar1.setVisible(True)
self.toolbar2.setVisible(True)
self.toolbar3.setVisible(True)
@dynamic_property
def toolbars_visible(self):
def fget(self):
return self.toolbar1.isVisible() or self.toolbar2.isVisible() or self.toolbar3.isVisible()
def fset(self, val):
getattr(self, ('show' if val else 'hide') + '_toolbars')()
return property(fget=fget, fset=fset)
def set_readonly(self, what):
self.editor.set_readonly(what)
def hide_tabs(self):
self.tabs.tabBar().setVisible(False)