本文整理汇总了Python中PySide.QtGui.QListWidget.currentRow方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.currentRow方法的具体用法?Python QListWidget.currentRow怎么用?Python QListWidget.currentRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.currentRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UiMain
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import currentRow [as 别名]
#.........这里部分代码省略.........
self.switch_active_item_button_off.setFont(QFont('SansSerif', 17))
self.switch_active_item_button_off.setGeometry(175, 55, 40, 30)
# on button
self.switch_active_item_button_on = QPushButton(self.options)
self.switch_active_item_button_on.setText('<-'.decode('utf-8'))
# makes <- readable and clear
self.switch_active_item_button_on.setFont(QFont('SansSerif', 17))
self.switch_active_item_button_on.setGeometry(175, 90, 40, 30)
QObject.connect(self.switch_active_item_button_on, SIGNAL
("clicked()"), self.switch_item_on)
QObject.connect(self.switch_active_item_button_off, SIGNAL
("clicked()"), self.switch_item_off)
# A button to toggle the split output in half option. It's a temporary
# fix for the Foobar double output problem.
self.switch_output_split_btn = QCheckBox(self.options)
self.switch_output_split_btn.setCheckState(Qt.CheckState.Unchecked)
self.switch_output_split_btn.setGeometry(10, 140, 40, 30)
self.switch_output_split_btn.stateChanged.connect(self.toggle_split)
# The label for the split toggle
self.switch_output_split_lbl = QLabel(self.options)
self.switch_output_split_lbl.setText(
"Split the output text in half (don't use this if you don't need it)")
self.switch_output_split_lbl.setGeometry(30, 140, 300, 30)
def switch_item_on(self):
""" Switches items (musicapps) on """
try:
# If an item from the active box is selected
# Remove it and place it inside the inactive box
item_taken = self.inactive_items_list.takeItem(
self.inactive_items_list.currentRow())
self.active_items_list.addItem(item_taken)
active_items = {}
inactive_items = {}
for i in range(self.active_items_list.count()):
active_items[self.active_items_list.item(i).text()] =\
ITEMS[self.active_items_list.item(i).text()
.encode('utf-8')]
for i in range(self.inactive_items_list.count()):
inactive_items[self.inactive_items_list.item(i).text()] =\
ITEMS[self.inactive_items_list.item(i).text()
.encode('utf-8')]
Constants.ACTIVE_ITEMS = active_items
Constants.INACTIVE_ITEMS = inactive_items
# clear the selection combobox
self.app_select_box.clear()
# Repopulate the combobox
self.app_select_box.addItem(None)
for item in active_items:
self.app_select_box.addItem(item)
Constants.CONFIG.set('active', item_taken.text(),
ITEMS[item_taken.text()])
Constants.CONFIG.remove_option('inactive', item_taken.text())
# Updates the config file to be up to date with activeItems
Constants.CONFIG.update()
except:
raise
def switch_item_off(self):
""" Switches items (musicapps) off """
try:
# If an item from the inactive box is selected.
# Remove it and place it inside the active box