本文整理汇总了Python中PyQt4.QtGui.QStackedLayout.takeAt方法的典型用法代码示例。如果您正苦于以下问题:Python QStackedLayout.takeAt方法的具体用法?Python QStackedLayout.takeAt怎么用?Python QStackedLayout.takeAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QStackedLayout
的用法示例。
在下文中一共展示了QStackedLayout.takeAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ComboEditor
# 需要导入模块: from PyQt4.QtGui import QStackedLayout [as 别名]
# 或者: from PyQt4.QtGui.QStackedLayout import takeAt [as 别名]
#.........这里部分代码省略.........
def show_combo_file(self):
self.bar.combo.showPopup()
def show_combo_symbol(self):
self.bar.symbols_combo.showPopup()
def split_editor(self, orientationVertical):
new_widget = ComboEditor()
for neditable in self.bar.get_editables():
new_widget.add_editor(neditable)
self.emit(SIGNAL("splitEditor(PyQt_PyObject, PyQt_PyObject, bool)"),
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():
new_combo.add_editor(neditable)
new_combo.resize(500, 500)
self.connect(new_combo, SIGNAL("aboutToCloseComboEditor()"),
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.emit(SIGNAL("allFilesClosed()"))
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.emit(SIGNAL("recentTabsModified()"))
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.file_path
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)
示例2: ProjectTreeColumn
# 需要导入模块: from PyQt4.QtGui import QStackedLayout [as 别名]
# 或者: from PyQt4.QtGui.QStackedLayout import takeAt [as 别名]
#.........这里部分代码省略.........
# Show the explorer if it is currently hidden
central = IDE.get_service('central_container')
if central and not central.is_lateral_panel_visible():
central.change_lateral_visibility()
# This highlights the index in the tree for us
project.setCurrentIndex(index)
# Loop through the parents to expand the tree
# all the way up to the selected index.
while index.isValid():
project.expand(index)
index = index.parent()
break
def add_project(self, project):
if project not in self.projects:
self._combo_project.addItem(project.name)
ptree = TreeProjectsWidget(project)
self._projects_area.addWidget(ptree)
self.connect(ptree, SIGNAL("closeProject(PyQt_PyObject)"),
self._close_project)
pmodel = project.model
ptree.setModel(pmodel)
pindex = pmodel.index(pmodel.rootPath())
ptree.setRootIndex(pindex)
self.projects.append(ptree)
current_index = self._projects_area.count()
self._projects_area.setCurrentIndex(current_index - 1)
self._combo_project.setCurrentIndex(current_index - 1)
def _close_project(self, widget):
"""Close the project related to the tree widget."""
index = self._projects_area.currentIndex()
self.projects.remove(widget)
self._projects_area.takeAt(index)
self._combo_project.removeItem(index)
index = self._combo_project.currentIndex()
self._projects_area.setCurrentIndex(index)
ninjaide = IDE.get_service('ide')
ninjaide.filesystem.close_project(widget.project.path)
widget.deleteLater()
def _change_current_project(self, index):
self._projects_area.setCurrentIndex(index)
def close_opened_projects(self):
for project in reversed(self.projects):
self._close_project(project)
def save_project(self):
"""Save all the opened files that belongs to the actual project."""
if self._active_project:
path = self._projects_area.currentWidget().project.path
main_container = IDE.get_service('main_container')
if path and main_container:
main_container.save_project(path)
def create_new_project(self):
wizard = new_project_manager.NewProjectManager(self)
wizard.show()
@property
def current_project(self):
if self._projects_area.count() > 0:
return self._projects_area.currentWidget().project
@property
示例3: _MainContainer
# 需要导入模块: from PyQt4.QtGui import QStackedLayout [as 别名]
# 或者: from PyQt4.QtGui.QStackedLayout import takeAt [as 别名]
#.........这里部分代码省略.........
widget = self.stack.widget(index)
if widget == self.selector:
continue
closable = True
if widget == self.splitter:
closable = False
pixmap = QPixmap.grabWidget(widget, widget.rect())
path = os.path.join(temp_dir, "screen%s.png" % index)
pixmap.save(path)
if index == current:
self.selector.set_preview(index, path)
collected_data.insert(0, (index, path, closable))
else:
collected_data.append((index, path, closable))
self.selector.set_model(collected_data)
else:
self.selector.close_selector()
def _selector_ready(self):
self.stack.setCurrentWidget(self.selector)
self.selector.start_animation()
def _selector_animation_completed(self):
if self._opening_dialog:
# We choose the last one with -2, -1 (for last one) +
# -1 for the hidden selector widget which is in the stacked too.
self.selector.open_item(self.stack.count() - 2)
self._opening_dialog = False
def _change_current_stack(self, index):
self.stack.setCurrentIndex(index)
def _remove_item_from_stack(self, index):
widget = self.stack.takeAt(index)
del widget
def show_editor_area(self):
self.stack.setCurrentWidget(self.splitter)
def _files_closed(self):
if settings.SHOW_START_PAGE:
self.show_start_page()
def change_visibility(self):
"""Show/Hide the Main Container area."""
if self.isVisible():
self.hide()
else:
self.show()
def expand_symbol_combo(self):
self.stack.setCurrentWidget(self.splitter)
self.current_widget.show_combo_symbol()
def expand_file_combo(self):
self.stack.setCurrentWidget(self.splitter)
self.current_widget.show_combo_file()
def locate_function(self, function, filePath, isVariable):
"""Move the cursor to the proper position in the navigate stack."""
editorWidget = self.get_current_editor()
if editorWidget:
self.__codeBack.append((editorWidget.file_path,
editorWidget.getCursorPosition()))
self.__codeForward = []
self._locator.navigate_to(function, filePath, isVariable)
示例4: ComboEditor
# 需要导入模块: from PyQt4.QtGui import QStackedLayout [as 别名]
# 或者: from PyQt4.QtGui.QStackedLayout import takeAt [as 别名]
class ComboEditor(QWidget):
def __init__(self, original=False):
super(ComboEditor, self).__init__()
self.__original = original
self._symbols_index = []
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.bar = ActionBar()
vbox.addWidget(self.bar)
self.stacked = QStackedLayout()
vbox.addLayout(self.stacked)
self._main_container = IDE.get_service('main_container')
self.connect(self.bar, SIGNAL("changeCurrent(PyQt_PyObject)"),
self.set_current)
self.connect(self.bar, SIGNAL("runFile(QString)"),
self._run_file)
self.connect(self.bar, SIGNAL("addToProject(QString)"),
self._add_to_project)
self.connect(self.bar, SIGNAL("goToSymbol(int)"),
self._go_to_symbol)
self.connect(self.bar, SIGNAL("reopenTab(QString)"),
lambda path: self._main_container.open_file(path))
self.connect(self.bar, SIGNAL("recentTabsModified()"),
lambda: self._main_container.recent_files_changed())
self.connect(self.bar.code_navigator.btnPrevious, SIGNAL("clicked()"),
lambda: self._navigate_code(False))
self.connect(self.bar.code_navigator.btnNext, SIGNAL("clicked()"),
lambda: self._navigate_code(True))
def _navigate_code(self, val):
op = self.bar.code_navigator.operation
self._main_container.navigate_code_history(val, op)
def currentWidget(self):
return self.stacked.currentWidget()
def add_editor(self, neditable):
"""Add Editor Widget to the UI area."""
if neditable.editor:
self.stacked.addWidget(neditable.editor)
self.bar.add_item(neditable.display_name, neditable)
# Editor Signals
self.connect(neditable.editor, SIGNAL("cursorPositionChanged()"),
self._update_cursor_position)
self.connect(neditable.editor, SIGNAL("currentLineChanged(int)"),
self._set_current_symbol)
self.connect(neditable, SIGNAL("checkersUpdated(PyQt_PyObject)"),
self._show_notification_icon)
self.connect(neditable, SIGNAL("fileSaved(PyQt_PyObject)"),
self._update_symbols)
# Connect file system signals only in the original
self.connect(neditable, SIGNAL("fileClosing(PyQt_PyObject)"),
self._close_file)
if self.__original:
self.connect(neditable,
SIGNAL("neverSavedFileClosing(PyQt_PyObject)"),
self._ask_for_save)
# Load Symbols
self._load_symbols(neditable)
def show_combo_file(self):
self.bar.combo.showPopup()
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()
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.emit(SIGNAL("recentTabsModified()"))
def _ask_for_save(self, neditable):
val = QMessageBox.No
fileName = neditable.file_path
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)
#.........这里部分代码省略.........