本文整理汇总了Python中picard.ui.itemviews.MainPanel.setSizes方法的典型用法代码示例。如果您正苦于以下问题:Python MainPanel.setSizes方法的具体用法?Python MainPanel.setSizes怎么用?Python MainPanel.setSizes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类picard.ui.itemviews.MainPanel
的用法示例。
在下文中一共展示了MainPanel.setSizes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from picard.ui.itemviews import MainPanel [as 别名]
# 或者: from picard.ui.itemviews.MainPanel import setSizes [as 别名]
#.........这里部分代码省略.........
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()
@throttle(100)
def update_statusbar_stats(self):
"""Updates the status bar information."""
self.infostatus.setFiles(len(self.tagger.files))
self.infostatus.setAlbums(len(self.tagger.albums))
self.infostatus.setPendingFiles(File.num_pending_files)
ws = self.tagger.webservice
self.infostatus.setPendingRequests(ws.num_pending_web_requests)
def update_statusbar_listen_port(self, listen_port):
if listen_port:
示例2: MainWindow
# 需要导入模块: from picard.ui.itemviews import MainPanel [as 别名]
# 或者: from picard.ui.itemviews.MainPanel import setSizes [as 别名]
#.........这里部分代码省略.........
if can_save and can_remove and can_edit_tags and can_refresh \
and can_autotag:
break
self.remove_action.setEnabled(can_remove)
self.save_action.setEnabled(can_save)
self.edit_tags_action.setEnabled(can_edit_tags)
self.analyze_action.setEnabled(can_analyze)
self.refresh_action.setEnabled(can_refresh)
self.autotag_action.setEnabled(can_autotag)
self.cut_action.setEnabled(bool(self.selected_objects))
def updateSelection(self, objects=None):
if objects is not None:
self.selected_objects = objects
else:
objects = self.selected_objects
self.update_actions()
orig_metadata = None
metadata = None
is_album = False
statusBar = u""
file = None
if len(objects) == 1:
obj = objects[0]
if isinstance(obj, File):
orig_metadata = obj.orig_metadata
metadata = obj.metadata
statusBar = obj.filename
if obj.state == obj.ERROR:
statusBar += _(" (Error: %s)") % obj.error
file = obj
elif isinstance(obj, Track):
if obj.num_linked_files == 1:
file = obj.linked_files[0]
orig_metadata = file.orig_metadata
metadata = file.metadata
statusBar = "%s (%d%%)" % (file.filename, file.similarity * 100)
if file.state == file.ERROR:
statusBar += _(" (Error: %s)") % file.error
elif obj.num_linked_files == 0:
metadata = obj.metadata
else:
metadata = obj.metadata
#Show dup zaper
elif isinstance(obj, Cluster):
orig_metadata = obj.metadata
is_album = True
elif isinstance(obj, Album):
metadata = obj.metadata
is_album = True
self.orig_metadata_box.set_metadata(orig_metadata, is_album)
self.metadata_box.set_metadata(metadata, is_album, file=file)
self.cover_art_box.set_metadata(metadata)
self.set_statusbar_message(statusBar)
def show_cover_art(self):
"""Show/hide the cover art box."""
if self.show_cover_art_action.isChecked():
self.cover_art_box.show()
else:
self.cover_art_box.hide()
def show_file_browser(self):
"""Show/hide the file browser."""
if self.show_file_browser_action.isChecked():
sizes = self.panel.sizes()
if sizes[0] == 0:
sizes[0] = sum(sizes) / 4
self.panel.setSizes(sizes)
self.file_browser.show()
else:
self.file_browser.hide()
def show_password_dialog(self, reply, authenticator):
dialog = PasswordDialog(authenticator, reply, parent=self)
dialog.exec_()
def show_proxy_dialog(self, proxy, authenticator):
dialog = ProxyDialog(authenticator, proxy, parent=self)
dialog.exec_()
def autotag(self):
self.tagger.autotag(self.panel.selected_objects())
def cut(self):
self._clipboard = self.panel.selected_objects()
self.paste_action.setEnabled(bool(self._clipboard))
def paste(self):
selected_objects = self.panel.selected_objects()
if not selected_objects:
target = self.tagger.unmatched_files
else:
target = selected_objects[0]
self.panel.views[0].drop_files(self.tagger.get_files_from_objects(self._clipboard), target)
self._clipboard = []
self.paste_action.setEnabled(False)
示例3: MainWindow
# 需要导入模块: from picard.ui.itemviews import MainPanel [as 别名]
# 或者: from picard.ui.itemviews.MainPanel import setSizes [as 别名]
#.........这里部分代码省略.........
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)
self.tagger.file_state_changed.connect(self.update_statusbar_files)
self.tagger.listen_port_changed.connect(self.update_statusbar_listen_port)
self.update_statusbar_files(0)
def update_statusbar_files(self, num_pending_files):
"""Updates the status bar information."""
self.file_counts_label.setText(_(" Files: %(files)d, Pending Files: %(pending)d ")
% {"files": self.tagger.num_files(), "pending": num_pending_files})
def update_statusbar_listen_port(self, listen_port):
self.listening_label.setVisible(True)
self.listening_label.setText(_(" Listening on port %(port)d ") % {"port": listen_port})
def set_statusbar_message(self, message, *args, **kwargs):
"""Set the status bar message."""
try:
if message:
self.log.debug(repr(message.replace('%%s', '%%r')), *args)