本文整理汇总了Python中PySide.QtGui.QAction.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setChecked方法的具体用法?Python QAction.setChecked怎么用?Python QAction.setChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QAction
的用法示例。
在下文中一共展示了QAction.setChecked方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_ui
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def setup_ui(self):
""" Setup the UI for the window.
"""
central_widget = QWidget()
layout = QVBoxLayout()
layout.addWidget(self.clock_view)
layout.addWidget(self.message_view)
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)
menubar = self.menuBar()
file_menu = QMenu('File')
preferences_action = QAction('Preferences', file_menu)
preferences_action.triggered.connect(self.on_preferences_triggered)
quit_action = QAction('Quit', file_menu)
quit_action.triggered.connect(self.on_quit_triggered)
file_menu.addAction(preferences_action)
file_menu.addAction(quit_action)
menubar.addMenu(file_menu)
view_menu = QMenu('View')
fullscreen_action = QAction('Fullscreen', view_menu)
fullscreen_action.setCheckable(True)
fullscreen_action.setChecked(Config.get('FULLSCREEN', True))
fullscreen_action.setShortcut('Ctrl+Meta+F')
fullscreen_action.toggled.connect(self.on_fullscreen_changed)
view_menu.addAction(fullscreen_action)
menubar.addMenu(view_menu)
示例2: showContextMenu
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def showContextMenu(self, point):
'Show the Columns context menu'
if self.model() is None:
return
# If we are viewing a proxy model, skip to the source model
mdl = self.model()
while isinstance(mdl, QAbstractProxyModel):
mdl = mdl.sourceModel()
if mdl is None or not hasattr(mdl, 'columns'):
return
# Generate and show the Menu
m = QMenu()
for i in range(len(mdl.columns)):
c = mdl.columns[i]
if c.internal:
continue
a = QAction(mdl.headerData(i, Qt.Horizontal, Qt.DisplayRole), m)
a.setCheckable(True)
a.setChecked(not self.isColumnHidden(i))
a.triggered.connect(partial(self.showHideColumn, c=i, s=self.isColumnHidden(i)))
m.addAction(a)
m.exec_(self.header().mapToGlobal(point))
示例3: on_show_debug_menu
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def on_show_debug_menu(self):
self.debug_menu.clear()
if self.is_master_cmd or self.power_user:
power_user_mode = QAction('Power User Mode', self)
power_user_mode.setCheckable(True)
power_user_mode.setChecked(MTTSettings.value('powerUser'))
power_user_mode.triggered.connect(self.__on_toggle_power_user)
self.debug_menu.addAction(power_user_mode)
self.is_master_cmd = False
self.debug_menu.addSeparator()
open_pref_folder_action = QAction('Open Preferences Folder', self)
open_pref_folder_action.setStatusTip('Open MTT preference folder')
open_pref_folder_action.triggered.connect(self.on_open_preference_folder)
self.debug_menu.addAction(open_pref_folder_action)
self.debug_menu.addSeparator()
database_dump_csv = QAction('Dump Database as CSV', self)
database_dump_csv.triggered.connect(self.view.model.database_dump_csv)
self.debug_menu.addAction(database_dump_csv)
database_dump_sql = QAction('Dump Database as SQL', self)
database_dump_sql.triggered.connect(self.view.model.database_dump_sql)
self.debug_menu.addAction(database_dump_sql)
self.debug_menu.addSeparator()
support_info = QMenu(self)
support_info.setTitle('Supported Node Type')
support_info.aboutToShow.connect(self.on_show_supported_type)
self.debug_menu.addMenu(support_info)
示例4: on_show_prompt_instance_delay_menu
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def on_show_prompt_instance_delay_menu(self):
prompt_instance_state = cmds.optionVar(query='MTT_prompt_instance_state')
if prompt_instance_state == PROMPT_INSTANCE_WAIT:
elapsed_time = time() - cmds.optionVar(query='MTT_prompt_instance_suspend')
if elapsed_time > PROMPT_INSTANCE_WAIT_DURATION:
prompt_instance_state = PROMPT_INSTANCE_ASK
cmds.optionVar(iv=['MTT_prompt_instance_state', prompt_instance_state])
else:
mtt_log('Remaining %.2fs' % (PROMPT_INSTANCE_WAIT_DURATION - elapsed_time))
elif prompt_instance_state == PROMPT_INSTANCE_SESSION:
if 'mtt_prompt_session' not in __main__.__dict__:
prompt_instance_state = PROMPT_INSTANCE_ASK
cmds.optionVar(iv=['MTT_prompt_instance_state', prompt_instance_state])
self.instance_menu.clear()
prompt_delay = QActionGroup(self)
prompt_delay.setExclusive(True)
for i in range(len(PROMPT_INSTANCE_STATE.keys())):
current_delay_action = QAction(PROMPT_INSTANCE_STATE[i], prompt_delay)
current_delay_action.setCheckable(True)
current_delay_action.setChecked(prompt_instance_state == i)
current_delay_action.triggered.connect(
partial(self.view.on_choose_instance_delay, i, prompt=i != 0))
self.instance_menu.addAction(current_delay_action)
示例5: _create_theme_menu
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def _create_theme_menu(self):
theme_menu = QMenu(self)
theme_menu.setTitle('Buttons Theme')
theme_menu.setTearOffEnabled(True)
theme_menu.setWindowTitle(TAG)
theme_actions = QActionGroup(self)
theme_actions.setExclusive(True)
# create ordered theme list
custom_order_theme = sorted(THEMES.iterkeys())
custom_order_theme.remove('Maya Theme')
custom_order_theme.insert(0, 'Maya Theme')
default_item = True
for theme in custom_order_theme:
current_theme_action = QAction(theme, theme_actions)
current_theme_action.setCheckable(True)
current_theme_action.setChecked(
MTTSettings.value('theme', 'Maya Theme') == theme)
current_theme_action.triggered.connect(self.on_change_theme)
theme_menu.addAction(current_theme_action)
if default_item:
theme_menu.addSeparator()
default_item = False
return theme_menu
示例6: add_action
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def add_action(lbl, tip, cmd, checkable=False, checked=False):
a = QAction(lbl, self)
a.setStatusTip(tip)
a.triggered.connect(cmd)
if checkable:
a.setCheckable(True)
a.setChecked(checked)
return a
示例7: on_show_supported_type
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def on_show_supported_type(self):
node_types = sorted(
[n_type for (n_type, nice, attr) in
MTTSettings.SUPPORTED_TYPE] + MTTSettings.UNSUPPORTED_TYPE)
support_info = self.sender()
support_info.clear()
for node_type in node_types:
current = QAction(node_type, self)
current.setEnabled(False)
current.setCheckable(True)
current.setChecked(node_type not in MTTSettings.UNSUPPORTED_TYPE)
support_info.addAction(current)
示例8: __init__
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def __init__(self):
QMainWindow.__init__(self)
# setup ui (the pcef GenericEditor is created there using
# the promoted widgets system)
self.ui = simple_editor_ui.Ui_MainWindow()
self.ui.setupUi(self)
self.setWindowTitle("PCEF - Generic Example")
editor = self.ui.genericEditor
# open this file
try:
openFileInEditor(self.ui.genericEditor, __file__)
except:
pass
# install Panel where user can add its own markers
p = UserMarkersPanel()
editor.installPanel(p, editor.PANEL_ZONE_LEFT)
# add a fold indicator around our class and the main
editor.foldPanel.addIndicator(136, 141)
# add styles actions
allStyles = styles.getAllStyles()
allStyles.sort()
self.styleActionGroup = QActionGroup(self)
for style in allStyles:
action = QAction(unicode(style), self.ui.menuStyle)
action.setCheckable(True)
action.setChecked(style == "Default")
self.styleActionGroup.addAction(action)
self.ui.menuStyle.addAction(action)
self.styleActionGroup.triggered.connect(
self.on_styleActionGroup_triggered)
# add panels actions
allPanels = self.ui.genericEditor.panels()
allPanels.sort()
self.panels_actions = []
for panel in allPanels:
action = QAction(unicode(panel), self.ui.menuPanels)
action.setCheckable(True)
action.setChecked(panel.enabled)
self.ui.menuPanels.addAction(action)
self.panels_actions.append(action)
action.triggered.connect(self.onPanelActionTriggered)
# add panels actions
allModes = self.ui.genericEditor.modes()
allModes.sort()
self.modes_actions = []
for mode in allModes:
action = QAction(unicode(mode), self.ui.menuModes)
action.setCheckable(True)
action.setChecked(mode.enabled)
self.ui.menuModes.addAction(action)
self.modes_actions.append(action)
action.triggered.connect(self.onModeActionTriggered)
示例9: __init__
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
def __init__(self):
QMainWindow.__init__(self)
# setup ui (the pcef PythonEditor is created in the Ui_MainWindow using
# the promoted widgets system)
self.ui = simple_python_editor_ui.Ui_MainWindow()
self.ui.setupUi(self)
self.setWindowTitle("PCEF - Python Editor Example")
self.acceptDrops()
# open this file
try:
openFileInEditor(self.ui.genericEditor, __file__)
except:
pass
# add styles actions
allStyles = styles.getAllStyles()
allStyles.sort()
self.styleActionGroup = QActionGroup(self)
for style in allStyles:
action = QAction(unicode(style), self.ui.menuStyle)
action.setCheckable(True)
action.setChecked(style == "Default")
self.styleActionGroup.addAction(action)
self.ui.menuStyle.addAction(action)
self.styleActionGroup.triggered.connect(
self.on_styleActionGroup_triggered)
# add panels actions
allPanels = self.ui.genericEditor.panels()
allPanels.sort()
self.panels_actions = []
for panel in allPanels:
action = QAction(unicode(panel), self.ui.menuPanels)
action.setCheckable(True)
action.setChecked(panel.enabled)
self.ui.menuPanels.addAction(action)
self.panels_actions.append(action)
action.triggered.connect(self.onPanelActionTriggered)
# add panels actions
allModes = self.ui.genericEditor.modes()
allModes.sort()
self.modes_actions = []
for mode in allModes:
action = QAction(unicode(mode), self.ui.menuModes)
action.setCheckable(True)
action.setChecked(mode.enabled)
self.ui.menuModes.addAction(action)
self.modes_actions.append(action)
action.triggered.connect(self.onModeActionTriggered)
示例10: PlotMainWindow
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
#.........这里部分代码省略.........
self.a_toend = QAction(self.style().standardIcon(QStyle.SP_MediaSeekForward), 'End', self)
self.a_step_backward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipBackward),
'Step Back', self)
self.a_step_forward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipForward), 'Step', self)
self.a_loop = QAction(self.style().standardIcon(QStyle.SP_BrowserReload), 'Loop', self)
self.a_loop.setCheckable(True)
toolbar.addAction(self.a_play)
toolbar.addAction(self.a_rewind)
toolbar.addAction(self.a_toend)
toolbar.addAction(self.a_step_backward)
toolbar.addAction(self.a_step_forward)
toolbar.addAction(self.a_loop)
if hasattr(self, 'save'):
self.a_save = QAction(self.style().standardIcon(QStyle.SP_DialogSaveButton), 'Save', self)
toolbar.addAction(self.a_save)
self.a_save.triggered.connect(self.save)
hlayout.addWidget(toolbar)
self.speed = QSlider(Qt.Horizontal)
self.speed.setMinimum(0)
self.speed.setMaximum(100)
hlayout.addWidget(QLabel('Speed:'))
hlayout.addWidget(self.speed)
layout.addLayout(hlayout)
self.timer = QTimer()
self.timer.timeout.connect(self.update_solution)
self.slider.valueChanged.connect(self.slider_changed)
self.slider.valueChanged.connect(lcd.display)
self.speed.valueChanged.connect(self.speed_changed)
self.a_play.toggled.connect(self.toggle_play)
self.a_rewind.triggered.connect(self.rewind)
self.a_toend.triggered.connect(self.to_end)
self.a_step_forward.triggered.connect(self.step_forward)
self.a_step_backward.triggered.connect(self.step_backward)
self.speed.setValue(50)
elif hasattr(self, 'save'):
hlayout = QHBoxLayout()
toolbar = QToolBar()
self.a_save = QAction(self.style().standardIcon(QStyle.SP_DialogSaveButton), 'Save', self)
toolbar.addAction(self.a_save)
hlayout.addWidget(toolbar)
layout.addLayout(hlayout)
self.a_save.triggered.connect(self.save)
self.setLayout(layout)
self.plot = plot
self.U = U
self.length = length
def slider_changed(self, ind):
self.plot.set(self.U, ind)
def speed_changed(self, val):
self.timer.setInterval(val * 20)
def update_solution(self):
ind = self.slider.value() + 1
if ind >= self.length:
if self.a_loop.isChecked():
ind = 0
else:
self.a_play.setChecked(False)
return
self.slider.setValue(ind)
def toggle_play(self, checked):
if checked:
if self.slider.value() + 1 == self.length:
self.slider.setValue(0)
self.timer.start()
else:
self.timer.stop()
def rewind(self):
self.slider.setValue(0)
def to_end(self):
self.a_play.setChecked(False)
self.slider.setValue(self.length - 1)
def step_forward(self):
self.a_play.setChecked(False)
ind = self.slider.value() + 1
if ind == self.length and self.a_loop.isChecked():
ind = 0
if ind < self.length:
self.slider.setValue(ind)
def step_backward(self):
self.a_play.setChecked(False)
ind = self.slider.value() - 1
if ind == -1 and self.a_loop.isChecked():
ind = self.length - 1
if ind >= 0:
self.slider.setValue(ind)
示例11: MainWindow
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
class MainWindow(QWidget):
def __init__(self, grid, U):
assert isinstance(U, Communicable)
super(MainWindow, self).__init__()
U = U.data
layout = QVBoxLayout()
plotBox = QHBoxLayout()
plot = GlumpyPatchWidget(self, grid, vmin=np.min(U), vmax=np.max(U), bounding_box=bounding_box, codim=codim)
bar = ColorBarWidget(self, vmin=np.min(U), vmax=np.max(U))
plotBox.addWidget(plot)
plotBox.addWidget(bar)
layout.addLayout(plotBox)
if len(U) == 1:
plot.set(U.ravel())
else:
plot.set(U[0])
hlayout = QHBoxLayout()
self.slider = QSlider(Qt.Horizontal)
self.slider.setMinimum(0)
self.slider.setMaximum(len(U) - 1)
self.slider.setTickPosition(QSlider.TicksBelow)
hlayout.addWidget(self.slider)
lcd = QLCDNumber(m.ceil(m.log10(len(U))))
lcd.setDecMode()
lcd.setSegmentStyle(QLCDNumber.Flat)
hlayout.addWidget(lcd)
layout.addLayout(hlayout)
hlayout = QHBoxLayout()
toolbar = QToolBar()
self.a_play = QAction(self.style().standardIcon(QStyle.SP_MediaPlay), 'Play', self)
self.a_play.setCheckable(True)
self.a_rewind = QAction(self.style().standardIcon(QStyle.SP_MediaSeekBackward), 'Rewind', self)
self.a_toend = QAction(self.style().standardIcon(QStyle.SP_MediaSeekForward), 'End', self)
self.a_step_backward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipBackward), 'Step Back', self)
self.a_step_forward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipForward), 'Step', self)
self.a_loop = QAction(self.style().standardIcon(QStyle.SP_BrowserReload), 'Loop', self)
self.a_loop.setCheckable(True)
toolbar.addAction(self.a_play)
toolbar.addAction(self.a_rewind)
toolbar.addAction(self.a_toend)
toolbar.addAction(self.a_step_backward)
toolbar.addAction(self.a_step_forward)
toolbar.addAction(self.a_loop)
hlayout.addWidget(toolbar)
self.speed = QSlider(Qt.Horizontal)
self.speed.setMinimum(0)
self.speed.setMaximum(100)
hlayout.addWidget(QLabel('Speed:'))
hlayout.addWidget(self.speed)
layout.addLayout(hlayout)
self.timer = QTimer()
self.timer.timeout.connect(self.update_solution)
self.slider.valueChanged.connect(self.slider_changed)
self.slider.valueChanged.connect(lcd.display)
self.speed.valueChanged.connect(self.speed_changed)
self.a_play.toggled.connect(self.toggle_play)
self.a_rewind.triggered.connect(self.rewind)
self.a_toend.triggered.connect(self.to_end)
self.a_step_forward.triggered.connect(self.step_forward)
self.a_step_backward.triggered.connect(self.step_backward)
self.speed.setValue(50)
self.setLayout(layout)
self.plot = plot
self.U = U
def slider_changed(self, ind):
self.plot.set(self.U[ind])
def speed_changed(self, val):
self.timer.setInterval(val * 20)
def update_solution(self):
ind = self.slider.value() + 1
if ind >= len(self.U):
if self.a_loop.isChecked():
ind = 0
else:
self.a_play.setChecked(False)
return
self.slider.setValue(ind)
def toggle_play(self, checked):
if checked:
if self.slider.value() + 1 == len(self.U):
#.........这里部分代码省略.........
示例12: SymbolWort
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
class SymbolWort(QWidget):
def __init__(self):
QWidget.__init__(self)
self.setWindowTitle("Symbol-Worte")
self.thread=MyWorker(self)
self.thread.start()
self.thread.calculator.calculationDone.connect(self.calculationDone)
self.initUI()
def about(self):
QMessageBox.information(self,u"Über Symbol-Worte",u"Symbol-Worte ist ein kleines, zum Spaß entwickeltes, Programm. Es nutzt die Open-Source Entwicklungsumgebung Python (www.python.org) und PySide (Qt-Schnittstelle). Es ist unter GPL v.3 veröffentlicht. Entwickelt von Peter Waldert.")
def update(self):
text=self.lineEdit.text()
if text.lower() != self.responseLabel.text().lower():
self.thread.startCalculation(text)
def calculationDone(self,ok):
if ok:
self.responseLabel.setText(self.thread.calculator.result)
else:
self.responseLabel.setText(u"Keine Treffer")
self.updateTable(self.thread.calculator.resultElements)
def updateAuto(self,checked):
if checked:
self.lineEdit.textEdited.connect(self.update)
else:
self.lineEdit.textEdited.disconnect(self.update)
def updateMaxLength(self,checked):
if checked:
self.lineEdit.setMaxLength(10)
else:
self.lineEdit.setMaxLength(100)
def setupTable(self):
self.tableWidget.setColumnCount(3)
self.tableWidget.setHorizontalHeaderLabels(["OZ","Sym","Name"])
self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
self.tableWidget.setSelectionMode(QTableWidget.SingleSelection)
self.tableWidget.setEditTriggers(QTableWidget.NoEditTriggers)
self.tableWidget.setAlternatingRowColors(True)
def updateTable(self,elements):
self.tableWidget.clearContents()
self.tableWidget.setRowCount(len(elements))
row=0
for element in elements:
self.tableWidget.setItem(row,0,QTableWidgetItem(str(element.atomicNumber)))
self.tableWidget.setItem(row,1,QTableWidgetItem(elements[row].symbol))
self.tableWidget.setItem(row,2,QTableWidgetItem(elements[row].name))
row+=1
self.tableWidget.resizeColumnsToContents()
def initUI(self):
wordLabel=QLabel("&Wort:")
responseLabel=QLabel("Symbol-Wort:")
progressLabel=QLabel("Rechen-Fortschritt:")
self.lineEdit=QLineEdit()
self.updateButton=QPushButton("&Berechnen")
self.autoUpdate=QCheckBox("&Auto-Berechnung")
self.responseLabel=QLabel()
wordLabel.setBuddy(self.lineEdit)
self.tableWidget=QTableWidget()
self.progressView=ProgressView()
self.disableMaxLengthAction=QAction("Zeichenmaximum (Achtung!)",self)
self.disableMaxLengthAction.setCheckable(True)
self.disableMaxLengthAction.toggled.connect(self.updateMaxLength)
self.disableMaxLengthAction.setChecked(True)
self.setupTable()
self.progressView.setProgress(self.thread.calculator.progress)
self.progressView.abortButton.setIcon(QIcon.fromTheme("process-stopp",QIcon("Abort.png")))
self.progressView.abortButton.setToolTip("Stoppe die Berechnung")
self.lineEdit.setValidator(QRegExpValidator(QRegExp("[A-Za-z]+")))
self.lineEdit.setToolTip("Nur Zeichen von A-Z")
self.lineEdit.setContextMenuPolicy(Qt.ActionsContextMenu)
self.lineEdit.addAction(self.disableMaxLengthAction)
self.responseLabel.setSizePolicy(QSizePolicy.Preferred,QSizePolicy.Fixed)
self.responseLabel.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken)
self.aboutButton=QPushButton(u"Über")
f=self.responseLabel.font()
f.setPointSize(24)
self.responseLabel.setFont(f)
self.lineEdit.returnPressed.connect(self.update)
self.updateButton.clicked.connect(self.update)
self.autoUpdate.stateChanged.connect(self.updateAuto)
self.aboutButton.clicked.connect(self.about)
layout=QGridLayout()
layout.addWidget(wordLabel,0,0)
layout.addWidget(self.lineEdit,0,1)
layout.addWidget(self.updateButton,0,2)
layout.addWidget(self.autoUpdate,1,1,1,2)
#.........这里部分代码省略.........
示例13: MainWindow
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
class MainWindow(QMainWindow):
""" Starting point of the GUI based application """
isMyProgressTimer = False
def __init__(self):
""" MainWindow Constructor Function"""
super(MainWindow, self).__init__()
wdgt = QWidget()
wdgt.setWindowTitle = "ManageHD"
self.setCentralWidget(wdgt)
self.InitUI()
self.GetParameterFileInfo()
def InitUI(self):
""" Initialize user created UI elements """
self.qlVidsDone = QLabel('0', self)
self.qlVidsInProgress = QLabel('0', self)
self.qlStartTime = QLabel(datetime.now().strftime("%a, %d %b %Y %H:%M:%S"), self)
self.qlEndTime = QLabel('', self)
self.qlTimeLeft = QLabel('', self)
self.qlDestinationSpace = QLabel('', self)
self.qlArcSpace = QLabel('', self)
self.qlProcessingSpeed = QLabel('', self)
self.qleSourceDir = QLineEditDirectoriesOnly()
self.qleArchiveDir = QLineEditDirectoriesOnly()
self.qleDestinationDir = QLineEditDirectoriesOnly()
self.qleMaxVidsCap = QLineEditIntsOnly()
self.qleVideoTypes = QLineEditNoPeriodsOrCommas()
self.qleVideoTypes.installEventFilter(self)
self.qpbSourceDir = self.__CreateButton('folder.png',"", 50, self.SelectSingleFileForSourceDirectory)
self.qpbArchiveDir = self.__CreateButton('folder.png',"", 50, self.SelectSingleFileForArchiveDirectory)
self.qpbTargetDir = self.__CreateButton('folder.png',"", 50, self.SelectSingleFileForTargetDirectory)
self.qpbRun = self.__CreateButton(None,"Run", 75, self.Process)
self.setWindowTitle("Manage HD Video")
self.videoExtensionFileFilter = "Video (*.mkv *.mp4 *.avi)"
self.qleVideoTypes.setText("mkv mp4 avi")
self.statusLabel = QLabel('Showing Progress')
self.progressBar = QProgressBar()
self.progressBar.setMinimum(0)
self.progressBar.setMaximum(100)
self.__CreateActions()
self.__CreateMenus()
self.fileMenu.addAction(self.stdAction)
self.fileMenu.addAction(self.altAction)
if Progress.runPlatform == 'win':
self.stdAction.setIcon(QIcon('checked.jpg'))
self.stdAction.setChecked(True)
self.fileMenu.addSeparator()
self.fileMenu.addAction(self.exitAction)
self.fileMenu.addSeparator()
self.helpMenu.addAction(self.aboutAction)
self.__SetIcon()
self.__CenterWindow()
self.__CreateGrid()
def eventFilter(self, source, event): #Override
""" Override the QMainWindow eventFilter method to add File Mask Validation. """
if (event.type() == QEvent.FocusOut and
source is self.qleVideoTypes):
self.ValidateFileMask()
return QMainWindow.eventFilter(self, source, event)
def DisableGuiElements(self):
""" Change the setEnabled property of the main GUI elements to False. """
self.qleArchiveDir.setEnabled(False)
self.qleDestinationDir.setEnabled(False)
self.qleMaxVidsCap.setEnabled(False)
self.qleSourceDir.setEnabled(False)
self.qleVideoTypes.setEnabled(False)
self.qpbArchiveDir.setEnabled(False)
self.qpbSourceDir.setEnabled(False)
self.qpbTargetDir.setEnabled(False)
self.qpbRun.setEnabled(False)
def EnableGuiElements(self):
""" Change the setEnabled property of the main GUI elements to True. """
self.qleArchiveDir.setEnabled(True)
self.qleDestinationDir.setEnabled(True)
self.qleMaxVidsCap.setEnabled(True)
self.qleSourceDir.setEnabled(True)
self.qleVideoTypes.setEnabled(True)
self.qpbArchiveDir.setEnabled(True)
self.qpbSourceDir.setEnabled(True)
self.qpbTargetDir.setEnabled(True)
self.qpbRun.setEnabled(True)
def __AddGridLabel(self, grid, lblText, custFont, row, column, justification):
sd = QLabel(lblText, self)
sd.setFont(custFont)
grid.addWidget(sd, row, column, alignment = justification)
def SelectSingleFileForSourceDirectory(self):
self.qleSourceDir.setText( self.InvokeSingleSelectionDirectoryDialog() )
self.ValidateFileMask()
def SelectSingleFileForArchiveDirectory(self):
#.........这里部分代码省略.........
示例14: MainWindow
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setChecked [as 别名]
#.........这里部分代码省略.........
saveFile.setShortcut('Ctrl+S')
saveFile.triggered.connect(self.save)
playFile = QAction(self.playicon, 'Play', self)
playFile.setShortcut('Ctrl+P')
playFile.triggered.connect(self.play)
pausePlayb = QAction(self.pauseicon, 'Pause', self)
pausePlayb.setShortcut('Ctrl+R')
pausePlayb.triggered.connect(self.pause)
stopPlay = QAction(self.stopicon, 'Stop', self)
stopPlay.setShortcut('Ctrl+Z')
stopPlay.triggered.connect(self.stop)
exitAction = QAction(self.quiticon, 'Quit', self)
exitAction.setShortcut('Ctrl+X')
exitAction.triggered.connect(self.quit)
aboutdlg = QAction(self.abouticon, 'About', self)
aboutdlg.setShortcut('Ctrl+A')
aboutdlg.triggered.connect(self.about)
showSett = QAction(self.setticon, 'Settings', self)
showSett.triggered.connect(self.settings)
menubar = self.menuBar()
fileMenu = menubar.addMenu('&File')
configMenu = menubar.addMenu('&Options')
configMenu.setStyleSheet("border: 1px solid black;")
self.setLooped = QAction('Loop', configMenu, checkable=True)
if self.progset.value("sound/Looped") == 'true': self.setLooped.setChecked(True)
else: self.setLooped.setChecked(False)
self.setLooped.setShortcut('Ctrl+L')
self.setAutoplay = QAction('Autoplay', configMenu, checkable=True)
if self.progset.value("sound/Autoplay") == 'true': self.setAutoplay.setChecked(True)
else: self.setAutoplay.setChecked(False)
self.setAutoplay.setShortcut('Ctrl+K')
configMenu.addAction(self.setAutoplay)
configMenu.addAction(self.setLooped)
fileMenu.setStyleSheet("border: 1px solid black;")
fileMenu.addAction(openFile)
fileMenu.addAction(saveFile)
fileMenu.addSeparator()
self.recentMenu = fileMenu.addMenu('Recent')
self.rfUpdate()
fileMenu.addSeparator()
fileMenu.addAction(showSett)
fileMenu.addSeparator()
fileMenu.addAction(exitAction)
helpMenu = menubar.addMenu('&Help')
helpMenu.setStyleSheet("border: 1px solid black;")
helpMenu.addAction(aboutdlg)
self.numCards = QSpinBox()
numCards_text = QLabel(" OPL : ")
self.numCards.setRange(1, 100)
self.numCards.setValue(int(self.progset.value("sound/numCards", 3)))