本文整理汇总了Python中picard.ui.metadatabox.MetadataBox.save_state方法的典型用法代码示例。如果您正苦于以下问题:Python MetadataBox.save_state方法的具体用法?Python MetadataBox.save_state怎么用?Python MetadataBox.save_state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类picard.ui.metadatabox.MetadataBox
的用法示例。
在下文中一共展示了MetadataBox.save_state方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from picard.ui.metadatabox import MetadataBox [as 别名]
# 或者: from picard.ui.metadatabox.MetadataBox import save_state [as 别名]
#.........这里部分代码省略.........
msg.setText(_(u"Are you sure you want to quit Picard?"))
txt = ungettext(
"There is %d unsaved file. Closing Picard will lose all unsaved changes.",
"There are %d unsaved files. Closing Picard will lose all unsaved changes.",
unsaved_files) % unsaved_files
msg.setInformativeText(txt)
cancel = msg.addButton(QMessageBox.Cancel)
msg.setDefaultButton(cancel)
msg.addButton(_(u"&Quit Picard"), QMessageBox.YesRole)
ret = msg.exec_()
if ret == QMessageBox.Cancel:
return False
return True
def saveWindowState(self):
self.config.persist["window_state"] = self.saveState()
isMaximized = int(self.windowState()) & QtCore.Qt.WindowMaximized != 0
if isMaximized:
# FIXME: this doesn't include the window frame
geom = self.normalGeometry()
self.config.persist["window_position"] = geom.topLeft()
self.config.persist["window_size"] = geom.size()
else:
pos = self.pos()
if not pos.isNull():
self.config.persist["window_position"] = pos
self.config.persist["window_size"] = self.size()
self.config.persist["window_maximized"] = isMaximized
self.config.persist["view_cover_art"] = self.show_cover_art_action.isChecked()
self.config.persist["view_file_browser"] = self.show_file_browser_action.isChecked()
self.config.persist["bottom_splitter_state"] = self.centralWidget().saveState()
self.file_browser.save_state()
self.panel.save_state()
self.metadata_box.save_state()
def restoreWindowState(self):
self.restoreState(self.config.persist["window_state"])
pos = self.config.persist["window_position"]
size = self.config.persist["window_size"]
self._desktopgeo = self.tagger.desktop().screenGeometry()
if pos.x() > 0 and pos.y() > 0 and pos.x()+size.width() < self._desktopgeo.width() and pos.y()+size.height() < self._desktopgeo.height():
self.move(pos)
if size.width() <= 0 or size.height() <= 0:
size = QtCore.QSize(780, 560)
self.resize(size)
if self.config.persist["window_maximized"]:
self.setWindowState(QtCore.Qt.WindowMaximized)
bottom_splitter_state = self.config.persist["bottom_splitter_state"]
if bottom_splitter_state.isEmpty():
self.centralWidget().setSizes([366, 194])
else:
self.centralWidget().restoreState(bottom_splitter_state)
self.file_browser.restore_state()
def create_statusbar(self):
"""Creates a new status bar."""
self.statusBar().showMessage(_("Ready"))
self.file_counts_label = QtGui.QLabel()
self.listening_label = QtGui.QLabel()
self.listening_label.setVisible(False)
self.listening_label.setToolTip(_("Picard listens on a port to integrate with your browser and downloads release"
" information when you click the \"Tagger\" buttons on the MusicBrainz website"))
self.statusBar().addPermanentWidget(self.file_counts_label)
self.statusBar().addPermanentWidget(self.listening_label)
示例2: MainWindow
# 需要导入模块: from picard.ui.metadatabox import MetadataBox [as 别名]
# 或者: from picard.ui.metadatabox.MetadataBox import save_state [as 别名]
#.........这里部分代码省略.........
unsaved_files = sum(a.get_num_unsaved_files() for a in self.tagger.albums.values())
QMessageBox = QtWidgets.QMessageBox
if unsaved_files > 0:
msg = QMessageBox(self)
msg.setIcon(QMessageBox.Question)
msg.setWindowModality(QtCore.Qt.WindowModal)
msg.setWindowTitle(_("Unsaved Changes"))
msg.setText(_("Are you sure you want to quit Picard?"))
txt = ngettext(
"There is %d unsaved file. Closing Picard will lose all unsaved changes.",
"There are %d unsaved files. Closing Picard will lose all unsaved changes.",
unsaved_files) % unsaved_files
msg.setInformativeText(txt)
cancel = msg.addButton(QMessageBox.Cancel)
msg.setDefaultButton(cancel)
msg.addButton(_("&Quit Picard"), QMessageBox.YesRole)
ret = msg.exec_()
if ret == QMessageBox.Cancel:
return False
return True
def saveWindowState(self):
config.persist["window_state"] = self.saveState()
isMaximized = int(self.windowState()) & QtCore.Qt.WindowMaximized != 0
self.save_geometry()
config.persist["window_maximized"] = isMaximized
config.persist["view_cover_art"] = self.show_cover_art_action.isChecked()
config.persist["view_toolbar"] = self.show_toolbar_action.isChecked()
config.persist["view_file_browser"] = self.show_file_browser_action.isChecked()
config.persist["bottom_splitter_state"] = self.centralWidget().saveState()
self.file_browser.save_state()
self.panel.save_state()
self.metadata_box.save_state()
@restore_method
def restoreWindowState(self):
self.restoreState(config.persist["window_state"])
self.restore_geometry()
if config.persist["window_maximized"]:
self.setWindowState(QtCore.Qt.WindowMaximized)
bottom_splitter_state = config.persist["bottom_splitter_state"]
if bottom_splitter_state.isEmpty():
self.centralWidget().setSizes([366, 194])
else:
self.centralWidget().restoreState(bottom_splitter_state)
self.file_browser.restore_state()
def create_statusbar(self):
"""Creates a new status bar."""
self.statusBar().showMessage(_("Ready"))
self.infostatus = InfoStatus(self)
self.listening_label = QtWidgets.QLabel()
self.listening_label.setVisible(False)
self.listening_label.setToolTip("<qt/>" + _(
"Picard listens on this port to integrate with your browser. When "
"you \"Search\" or \"Open in Browser\" from Picard, clicking the "
"\"Tagger\" button on the web page loads the release into Picard."
))
self.statusBar().addPermanentWidget(self.infostatus)
self.statusBar().addPermanentWidget(self.listening_label)
self.tagger.tagger_stats_changed.connect(self.update_statusbar_stats)
self.tagger.listen_port_changed.connect(self.update_statusbar_listen_port)
self.update_statusbar_stats()