本文整理汇总了Python中PyQt4.QtGui.QStackedLayout.insertWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QStackedLayout.insertWidget方法的具体用法?Python QStackedLayout.insertWidget怎么用?Python QStackedLayout.insertWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QStackedLayout
的用法示例。
在下文中一共展示了QStackedLayout.insertWidget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _MainContainer
# 需要导入模块: from PyQt4.QtGui import QStackedLayout [as 别名]
# 或者: from PyQt4.QtGui.QStackedLayout import insertWidget [as 别名]
#.........这里部分代码省略.........
#if not reloaded:
#self.save_file(editorWidget)
#for i in range(self.tabsecondary.count()):
#editorWidget = self.tabsecondary.widget(i)
#self.tabsecondary.check_for_external_modifications(editorWidget)
#if type(editorWidget) is editor.Editor:
#reloaded = self.tabsecondary.check_for_external_modifications(
#editorWidget)
#if not reloaded:
#self.save_file(editorWidget)
def call_editors_function(self, call_function, *arguments):
pass
#args = arguments[0]
#kwargs = arguments[1]
#for i in range(self.tabs.count()):
#editorWidget = self.tabs.widget(i)
#if isinstance(editorWidget, editor.Editor):
#function = getattr(editorWidget, call_function)
#function(*args, **kwargs)
#TODO: add other splits
def show_start_page(self):
start = self.stack.widget(0)
if isinstance(start, start_page.StartPage):
self.stack.setCurrentIndex(0)
else:
startPage = start_page.StartPage(parent=self)
self.connect(startPage, SIGNAL("openProject(QString)"),
self.open_project)
self.connect(startPage, SIGNAL("openPreferences()"),
lambda: self.emit(SIGNAL("openPreferences()")))
self.connect(startPage, SIGNAL("newFile()"), self.add_editor)
self.stack.insertWidget(0, startPage)
self.stack.setCurrentIndex(0)
def show_python_doc(self):
if sys.platform == 'win32':
self.docPage = browser_widget.BrowserWidget(
'http://docs.python.org/')
else:
process = runner.start_pydoc()
self.docPage = browser_widget.BrowserWidget(process[1], process[0])
self.add_tab(self.docPage, translations.TR_PYTHON_DOC)
def show_report_bugs(self):
webbrowser.open(resources.BUGS_PAGE)
def show_plugins_doc(self):
bugsPage = browser_widget.BrowserWidget(resources.PLUGINS_DOC, self)
self.add_tab(bugsPage, translations.TR_HOW_TO_WRITE_PLUGINS)
def editor_jump_to_line(self, lineno=None):
"""Jump to line *lineno* if it is not None
otherwise ask to the user the line number to jump
"""
editorWidget = self.get_current_editor()
if editorWidget:
editorWidget.jump_to_line(lineno=lineno)
def get_opened_documents(self):
#return self.tabs.get_documents_data()
return []
def check_for_unsaved_files(self):
pass
示例2: BarraConversa
# 需要导入模块: from PyQt4.QtGui import QStackedLayout [as 别名]
# 或者: from PyQt4.QtGui.QStackedLayout import insertWidget [as 别名]
class BarraConversa(QWidget):
conversasNaoVisualizadas = pyqtSignal(Usuario, int)
def __init__(self, servico, parent=None):
super().__init__(parent)
self._configurarGui()
self._servico = servico
self._servico.dadosUsuarioAtualizado.connect(self._atualizarUsuario)
self._servico.conversaRecebida.connect(self._receberConversa)
self._servico.informacaoTipoValorRecebida.connect(self._receberSituacao)
def _configurarGui(self):
self._stackedLayout = QStackedLayout(self)
self._stackedLayout.setMargin(0)
self.setLayout(self._stackedLayout)
self._mostrarTelaInicial()
def _setNumConversasNaoVisualizadas(self, barraConversaUsuario, numConversasNaoVisualizadas):
barraConversaUsuario.setNumConversasNaoVisualizadas(numConversasNaoVisualizadas)
self.conversasNaoVisualizadas.emit(barraConversaUsuario.getUsuario(), numConversasNaoVisualizadas)
def _receberConversa(self, de, inf):
usuario = Usuario(nome=NOME_DEFAULT, ip=de)
barraConversaUsuario = self._getOrCreateBarraConversaUsuario(usuario)
barraConversaUsuario.receberTexto(inf)
if self._stackedLayout.currentWidget() != barraConversaUsuario:
numConversasNaoVisualizadasAtual = barraConversaUsuario.getNumConversasNaoVisualizadas() + 1
self._setNumConversasNaoVisualizadas(barraConversaUsuario, numConversasNaoVisualizadasAtual)
def _receberSituacao(self, de, tipo, valor):
if tipo == ServicoClienteMensageiro.INFORMACAO:
usuario = Usuario(nome=NOME_DEFAULT, ip=de)
self._getOrCreateBarraConversaUsuario(usuario).atualizarSituacao(valor['informacao'])
def _atualizarUsuario(self, usuario):
self._getOrCreateBarraConversaUsuario(usuario).setUsuario(usuario)
def _mostrarTelaInicial(self):
lbl = QLabel("<- Selecione o Usuário")
self._stackedLayout.insertWidget(0, lbl)
self._stackedLayout.setCurrentIndex(0)
def _setConversaUsuarioAtual(self, barraConversaUsuario):
ind = self._indexWidgetConversa(barraConversaUsuario.getUsuario())
self._stackedLayout.setCurrentIndex(ind)
def _indexWidgetConversa(self, usuario):
for i in range(1, self._stackedLayout.count()):
if self._stackedLayout.widget(i).getUsuario().getIP() == usuario.getIP():
return i
return -1
def _getOrCreateBarraConversaUsuario(self, usuario):
ind = self._indexWidgetConversa(usuario)
if ind != -1:
return self._stackedLayout.widget(ind)
else:
barraConversaUsuario = BarraConversaUsuario(self._servico, usuario)
self._stackedLayout.addWidget(barraConversaUsuario)
return barraConversaUsuario
def setUsuarioAtual(self, usuario):
"""Altera a conversa visível para a conversa do usuário
e reinicia a contagem de conversas não visualizadas."""
barraConversaUsuario = self._getOrCreateBarraConversaUsuario(usuario)
barraConversaUsuario.setUsuario(usuario)
self._setNumConversasNaoVisualizadas(barraConversaUsuario, 0)
self._setConversaUsuarioAtual(barraConversaUsuario)