本文整理汇总了Python中PyQt5.QtWidgets.QDockWidget.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Python QDockWidget.isVisible方法的具体用法?Python QDockWidget.isVisible怎么用?Python QDockWidget.isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QDockWidget
的用法示例。
在下文中一共展示了QDockWidget.isVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainForm
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import isVisible [as 别名]
#.........这里部分代码省略.........
vBLayout.setSpacing(0)
vBLayout.setContentsMargins(0, 0, 0, 0)
for key in module.mainform.toolbar:
action = module.mainform.actions[key]
button = QToolButton()
button.setText(action.text)
button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
button.setIconSize(iconsize)
button.setAutoRaise(True)
if action.icon:
button.setIcon(action.icon)
button.clicked.connect(action.run)
vBLayout.addWidget(button)
self.addToMenuPineboo(action, module)
vBLayout.addStretch()
def closeEvent(self, evnt):
res = QMessageBox.information(
QApplication.activeWindow(),
"Salir de Pineboo",
"¿ Desea salir ?",
QMessageBox.Yes, QMessageBox.No)
if res == QMessageBox.No:
evnt.ignore()
self.saveState()
def saveState(self):
if self:
sett_ = FLSettings()
sett_.writeEntryList("application/mainForm/tabsOpened", self.openTabs)
sett_.writeEntry("application/mainForm/viewFavorites", self.dockFavoritos.isVisible())
sett_.writeEntry("application/mainForm/FavoritesSize", self.dockFavoritos.size())
sett_.writeEntry("application/mainForm/viewAreas", self.dockAreasTab.isVisible())
sett_.writeEntry("application/mainForm/AreasSize", self.dockFavoritos.size())
sett_.writeEntry("application/mainForm/mainFormSize", self.size())
def addToMenuPineboo(self, ac, mod):
#print(mod.name, ac.name, pineboolib.project.areas[mod.areaid].descripcion)
# Comprueba si el area ya se ha creado
if mod.areaid not in self.mPAreas.keys():
areaM = self.menuPineboo.addMenu(QtGui.QIcon('share/icons/gtk-open.png'),
pineboolib.project.areas[mod.areaid].descripcion)
self.mPAreas[mod.areaid] = areaM
else:
areaM = self.mPAreas[mod.areaid]
# Comprueba si el modulo ya se ha creado
if mod.name not in self.mPModulos.keys():
pixmap = None
if mod.icon[0] != "":
pixmap = QtGui.QPixmap(mod.icon)
if pixmap:
moduloM = areaM.addMenu(QtGui.QIcon(pixmap), mod.description)
else:
moduloM = areaM.addMenu(mod.description)
self.mPModulos[mod.name] = moduloM
else:
moduloM = self.mPModulos[mod.name]
action_ = moduloM.addAction(ac.icon, ac.text)
action_.triggered.connect(ac.run)
示例2: MusicPlayer
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import isVisible [as 别名]
#.........这里部分代码省略.........
playlist_item = QListWidgetItem(filename)
playlist_item.setToolTip(filename)
self.playlist_view.addItem(playlist_item)
self.player.setPlaylist(self.playlist)
self.player.play()
def display_meta_data(self):
"""Display the current song's metadata in the main window.
If the current song contains metadata, its cover art is extracted and shown in
the main window while the track number, artist, album, and track title are shown
in the window title.
"""
if self.player.isMetaDataAvailable():
file_path = self.player.currentMedia().canonicalUrl().toLocalFile()
(album, artist, title, track_number, *__, artwork) = metadata.metadata(file_path)
try:
self.pixmap.loadFromData(artwork)
except TypeError:
self.pixmap = QPixmap(artwork)
meta_data = '{} - {} - {} - {}' .format(track_number, artist, album, title)
self.setWindowTitle(meta_data)
self.art.setScaledContents(True)
self.art.setPixmap(self.pixmap)
self.layout.addWidget(self.art)
def initialize_playlist(self, start):
"""Display playlist and reset playback mode when media inserted into playlist."""
if start == 0:
if self.library_dock.isVisible():
self.playlist_dock.setVisible(True)
self.playlist_dock.show()
self.playlist_dock.raise_()
if self.playlist.playbackMode() != QMediaPlaylist.Sequential:
self.playlist.setPlaybackMode(QMediaPlaylist.Sequential)
repeat_icon = utilities.resource_filename('mosaic.images', 'md_repeat_none.png')
self.repeat_action.setIcon(QIcon(repeat_icon))
def press_playback(self, event):
"""Change the playback of the player on cover art mouse event.
When the cover art is clicked, the player will play the media if the player is
either paused or stopped. If the media is playing, the media is set
to pause.
"""
if event.button() == 1 and configuration.Playback().cover_art_playback.isChecked():
if (self.player.state() == QMediaPlayer.StoppedState or
self.player.state() == QMediaPlayer.PausedState):
self.player.play()
elif self.player.state() == QMediaPlayer.PlayingState:
self.player.pause()
def seek(self, seconds):
"""Set the position of the song to the position dragged to by the user."""
self.player.setPosition(seconds * 1000)
def song_duration(self, duration):
"""Set the slider to the duration of the currently played media."""
duration /= 1000
self.duration = duration
self.slider.setMaximum(duration)