本文整理汇总了Python中PyQt5.QtWidgets.QStackedLayout.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Python QStackedLayout.isEmpty方法的具体用法?Python QStackedLayout.isEmpty怎么用?Python QStackedLayout.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QStackedLayout
的用法示例。
在下文中一共展示了QStackedLayout.isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ComboEditor
# 需要导入模块: from PyQt5.QtWidgets import QStackedLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QStackedLayout import isEmpty [as 别名]
#.........这里部分代码省略.........
def clone(self):
combo = ComboEditor()
for neditable in self.bar.get_editables():
combo.add_editor(neditable)
return combo
def split_editor(self, orientation):
new_combo = self.clone()
self.splitEditor.emit(self, new_combo, orientation)
def undock_editor(self):
new_combo = ComboEditor()
for neditable in self.bar.get_editables():
new_combo.add_editor(neditable)
self.__undocked.append(new_combo)
new_combo.setWindowTitle("NINJA-IDE")
editor = self.current_editor()
new_combo.set_current(editor.neditable)
new_combo.resize(700, 500)
new_combo.about_to_close_combo_editor.connect(self._remove_undock)
new_combo.show()
def _remove_undock(self):
widget = self.sender()
self.__undocked.remove(widget)
def close_current_file(self):
self.bar.about_to_close_file()
def _close_image(self, index):
layout_item = self.stacked.takeAt(index)
layout_item.widget().deleteLater()
if self.stacked.isEmpty():
self.bar.hide()
self.allFilesClosed.emit()
def _close_file(self, neditable):
index = self.bar.close_file(neditable)
layoutItem = self.stacked.takeAt(index)
# neditable.editor.completer.cc.unload_module()
self.fileClosed.emit(neditable.nfile)
layoutItem.widget().deleteLater()
if self.stacked.isEmpty():
self.bar.hide()
self.allFilesClosed.emit()
tree_symbols = IDE.get_service("symbols_explorer")
if tree_symbols is not None:
tree_symbols.clear()
def _editor_with_focus(self):
self._main_container.combo_area = self
editor = self.current_editor()
if editor is not None:
self._main_container.current_editor_changed(
editor.neditable.file_path)
self._load_symbols(editor.neditable)
editor.neditable.update_checkers_display()
def _ask_for_save(self, neditable):
val = QMessageBox.No
fileName = neditable.nfile.file_name
val = QMessageBox.question(
self, (self.tr('The file %s was not saved') %
fileName),
示例2: ComboEditor
# 需要导入模块: from PyQt5.QtWidgets import QStackedLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QStackedLayout import isEmpty [as 别名]
#.........这里部分代码省略.........
def split_editor(self, orientationVertical):
new_widget = ComboEditor()
for neditable in self.bar.get_editables():
print("\nsplit_editor", neditable, new_widget)
new_widget.add_editor(neditable)
self.splitEditor.emit(self, new_widget, orientationVertical)
def undock_editor(self):
new_combo = ComboEditor()
new_combo.setWindowTitle("NINJA-IDE")
self.__undocked.append(new_combo)
for neditable in self.bar.get_editables():
print("undock_editor", neditable)
new_combo.add_editor(neditable)
new_combo.resize(500, 500)
new_combo.aboutToCloseComboEditor.connect(self._remove_undock)
new_combo.show()
def _remove_undock(self):
widget = self.sender()
self.__undocked.remove(widget)
def close_current_file(self):
self.bar.about_to_close_file()
def _close_file(self, neditable):
index = self.bar.close_file(neditable)
layoutItem = self.stacked.takeAt(index)
#neditable.editor.completer.cc.unload_module()
self._add_to_last_opened(neditable.file_path)
layoutItem.widget().deleteLater()
if self.stacked.isEmpty():
self.allFilesClosed.emit()
def _add_to_last_opened(self, path):
if path not in settings.LAST_OPENED_FILES:
settings.LAST_OPENED_FILES.append(path)
if len(settings.LAST_OPENED_FILES) > settings.MAX_REMEMBER_TABS:
self.__lastOpened = self.__lastOpened[1:]
self.recentTabsModified.emit()
def _editor_with_focus(self):
if self._main_container.current_widget is not self:
self._main_container.current_widget = self
editor = self.stacked.currentWidget()
self._main_container.current_editor_changed(
editor.neditable.file_path)
self._load_symbols(editor.neditable)
editor.neditable.update_checkers_display()
def _ask_for_save(self, neditable):
val = QMessageBox.No
fileName = neditable.nfile.file_name
val = QMessageBox.question(
self, (self.tr('The file %s was not saved') %
fileName),
self.tr("Do you want to save before closing?"),
QMessageBox.Yes | QMessageBox.No |
QMessageBox.Cancel)
if val == QMessageBox.No:
neditable.nfile.close(force_close=True)
elif val == QMessageBox.Yes:
neditable.ignore_checkers = True
self._main_container.save_file(neditable.editor)