本文整理汇总了Python中main_window.MainWindow.x方法的典型用法代码示例。如果您正苦于以下问题:Python MainWindow.x方法的具体用法?Python MainWindow.x怎么用?Python MainWindow.x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main_window.MainWindow
的用法示例。
在下文中一共展示了MainWindow.x方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MusicGuru
# 需要导入模块: from main_window import MainWindow [as 别名]
# 或者: from main_window.MainWindow import x [as 别名]
class MusicGuru(MusicGuruBase, ApplicationBase):
LOGO_NAME = 'mg_logo'
def __init__(self):
appdata = str(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
MusicGuruBase.__init__(self, appdata)
ApplicationBase.__init__(self)
if not op.exists(appdata):
os.makedirs(appdata)
logging.basicConfig(filename=op.join(appdata, 'debug.log'), level=logging.WARNING)
self.prefs = Preferences()
self.prefs.load()
self.selectedBoardItems = []
self.selectedLocation = None
self.mainWindow = MainWindow(app=self)
self.locationsPanel = LocationsPanel(app=self)
self.detailsPanel = DetailsPanel(app=self)
self.ignoreBox = IgnoreBox(app=self)
self.progress = Progress(self.mainWindow)
self.aboutBox = AboutBox(self.mainWindow, self)
self.connect(self.progress, SIGNAL('finished(QString)'), self.jobFinished)
self.connect(self, SIGNAL('applicationFinishedLaunching()'), self.applicationFinishedLaunching)
#--- Private
def _placeDetailsPanel(self):
# locations panel must be placed first
if self.detailsPanel.isVisible():
return
desktop = QApplication.desktop()
w = self.locationsPanel.width()
h = self.detailsPanel.height()
x = self.locationsPanel.x()
windowBottom = self.locationsPanel.frameGeometry().y() + self.locationsPanel.frameGeometry().height()
y = windowBottom
self.detailsPanel.move(x, y)
self.detailsPanel.resize(w, h)
def _placeIgnoreBox(self):
if self.ignoreBox.isVisible():
return
desktop = QApplication.desktop()
windowWidth = self.mainWindow.frameGeometry().width()
frameWidth = self.ignoreBox.frameGeometry().width() - self.ignoreBox.width()
w = windowWidth - frameWidth
h = self.ignoreBox.height()
x = self.mainWindow.x()
windowBottom = self.mainWindow.frameGeometry().y() + self.mainWindow.frameGeometry().height()
y = min(windowBottom, desktop.height() - h)
self.ignoreBox.move(x, y)
self.ignoreBox.resize(w, h)
def _placeLocationsPanel(self):
if self.locationsPanel.isVisible():
return
desktop = QApplication.desktop()
w = self.locationsPanel.width()
windowHeight = self.mainWindow.frameGeometry().height()
frameHeight = self.locationsPanel.frameGeometry().height() - self.locationsPanel.height()
h = windowHeight - frameHeight - self.detailsPanel.frameGeometry().height()
windowRight = self.mainWindow.frameGeometry().x() + self.mainWindow.frameGeometry().width()
x = min(windowRight, desktop.width() - w)
y = self.mainWindow.y()
self.locationsPanel.move(x, y)
self.locationsPanel.resize(w, h)
def _setup_as_registered(self):
self.prefs.registration_code = self.registration_code
self.prefs.registration_email = self.registration_email
self.prefs.save()
self.mainWindow.actionRegister.setVisible(False)
self.aboutBox.registerButton.hide()
self.aboutBox.registeredEmailLabel.setText(self.prefs.registration_email)
def _startJob(self, jobid, func):
title = JOBID2TITLE[jobid]
try:
j = self.progress.create_job()
self.progress.run(jobid, title, func, args=(j, ))
except job.JobInProgressError:
msg = "A previous action is still hanging in there. You can't start a new one yet. Wait a few seconds, then try again."
QMessageBox.information(self.mainWindow, "Action in progress", msg)
#--- Public
def addLocation(self, path, name, removeable):
def do(j):
MusicGuruBase.AddLocation(self, path, name, removeable, j)
error_msg = self.CanAddLocation(path, name)
if error_msg:
QMessageBox.warning(self.mainWindow, "Add Location", error_msg)
return
self._startJob(JOB_ADD, do)
def addLocationPrompt(self):
dialog = AddLocationDialog(self)
result = dialog.exec_()
if result == QDialog.Accepted:
self.addLocation(dialog.locationPath, dialog.locationName, dialog.isLocationRemovable)
#.........这里部分代码省略.........