本文整理汇总了Python中preferences.Preferences.show方法的典型用法代码示例。如果您正苦于以下问题:Python Preferences.show方法的具体用法?Python Preferences.show怎么用?Python Preferences.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类preferences.Preferences
的用法示例。
在下文中一共展示了Preferences.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open_preferences
# 需要导入模块: from preferences import Preferences [as 别名]
# 或者: from preferences.Preferences import show [as 别名]
def open_preferences(self, widget):
ConfigManager.disable_losefocus_temporary = True
prefs = Preferences()
prefs.show()
示例2: Window
# 需要导入模块: from preferences import Preferences [as 别名]
# 或者: from preferences.Preferences import show [as 别名]
class Window(QWidget):
"""The main front end for the application."""
def __init__(self, config):
# Initialize the object as a QWidget and
# set its title and minimum width
QWidget.__init__(self)
self.config = config
self.peerList = config.peerList
self.setWindowTitle('BlastShare')
self.setMinimumSize(320, 480)
self.setMaximumWidth(320)
self.prefw = None
# connects the signals!
self.connect(self.peerList,
SIGNAL("initTransfer"), self.sendFileToPeer)
''' Will add feature in future version '''
'''
shareFilesAction = QAction(QIcon('exit.png'), '&Share File(s)', self)
shareFilesAction.setShortcut('Ctrl+O')
shareFilesAction.setStatusTip('Share File(s)')
shareFilesAction.triggered.connect(quitApp)
'''
preferencesAction = QAction(QIcon('exit.png'), '&Preferences', self)
preferencesAction.setShortcut('Ctrl+P')
preferencesAction.setStatusTip('Preferences')
preferencesAction.triggered.connect(self.editPreferences)
exitAction = QAction(QIcon('exit.png'), '&Exit', self)
exitAction.setShortcut('Ctrl+Q')
exitAction.setStatusTip('Exit application')
exitAction.triggered.connect(quitApp)
menubar = QMenuBar()
fileMenu = menubar.addMenu('&File')
''' Will enable in future versions '''
# fileMenu.addAction(shareFilesAction)
fileMenu.addAction(preferencesAction)
fileMenu.addAction(exitAction)
layout = QVBoxLayout()
layout.setContentsMargins(QMargins(0, 0, 0, 0))
self.setLayout(layout)
statusBar = QStatusBar()
statusBar.showMessage('Ready')
layout.addWidget(menubar)
layout.addWidget(self.peerList)
layout.addWidget(statusBar)
def sendFileToPeer(self, fileName, peerID, peerAddress, peerPort):
log.msg("File dropped {0}".format(fileName))
session = Session(str(fileName), self.config, peerAddress, peerPort)
self.config.sessions[str(session.id)] = session
session.startTransfer()
def questionMessage(self, fileName, peerName):
reply = QMessageBox.question(self, "Accept file download?",
"Do you want to accept the {0} from {1}?".format(fileName,
peerName),
QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
if reply == QMessageBox.Yes:
return "yes"
elif reply == QMessageBox.No:
return "no"
else:
return "cancel"
def editPreferences(self):
""" Launches the edit preferences dialog for this window. """
self.prefw = Preferences(self)
self.prefw.show()
def run(self):
self.show()
QT_APP.exec_()