本文整理汇总了Python中PyQt4.QtGui.QStringListModel类的典型用法代码示例。如果您正苦于以下问题:Python QStringListModel类的具体用法?Python QStringListModel怎么用?Python QStringListModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QStringListModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, project, parent=None):
'''
Setup dialog widgets with the project properties
'''
super(PosiviewProperties, self).__init__("PosiViewProperties", parent)
self.setupUi(self)
self.groupBox_6.hide()
self.initOptionsBase(False)
self.restoreOptionsBaseUi()
self.comboBoxParser.addItems(PARSERS)
self.comboBoxProviderType.addItems(DEVICE_TYPES)
self.project = project
self.projectProperties = project.properties()
self.mToolButtonLoad.setDefaultAction(self.actionLoadConfiguration)
self.mToolButtonSave.setDefaultAction(self.actionSaveConfiguration)
self.mobileModel = QStringListModel()
self.mobileListModel = QStringListModel()
self.mMobileListView.setModel(self.mobileListModel)
self.mobileProviderModel = QStandardItemModel()
self.mobileProviderModel.setHorizontalHeaderLabels(('Provider', 'Filter'))
self.mMobileProviderTableView.setModel(self.mobileProviderModel)
self.providerListModel = QStringListModel()
self.mDataProviderListView.setModel(self.providerListModel)
self.comboBoxProviders.setModel(self.providerListModel)
self.setupModelData(self.projectProperties)
self.setupGeneralData(self.projectProperties)
示例2: AppletNoticeWindow
class AppletNoticeWindow(QWidget):
def __init__(self, controller):
QWidget.__init__(self)
self.__controller = controller
self.__pkglist = []
# setup widgets
self.__vbox_up = QVBoxLayout()
self.__critical_label = QLabel()
self.__critical_label.setWordWrap(True)
self.__list_model = QStringListModel()
self.__list_view = QListView()
self.__list_view.setModel(self.__list_model)
self.__vbox_up.addWidget(self.__critical_label)
self.__vbox_up.addWidget(self.__list_view)
# bottom buttons
self.__vbox = QVBoxLayout()
self.__vbox.addLayout(self.__vbox_up)
self.__button_hbox = QHBoxLayout()
self.__close_button = QPushButton(_("Close"))
self.__launch_pm_button = QPushButton(_("Launch Application Browser"))
self.__button_hbox.addWidget(self.__launch_pm_button)
self.__button_hbox.addWidget(self.__close_button)
self.__vbox.addLayout(self.__button_hbox)
self.setLayout(self.__vbox)
# set window settings
self.resize(400, 200)
self.setWindowTitle(_("Application updates"))
self.connect(self.__close_button, SIGNAL("clicked()"), self.on_close)
self.connect(self.__launch_pm_button, SIGNAL("clicked()"), self.on_pm)
def closeEvent(self, event):
"""
We don't want to kill the window, since the whole app will close
otherwise.
"""
event.ignore()
self.on_close()
def on_pm(self):
self.__controller.launch_package_manager()
def on_close(self):
self.__controller.trigger_notice_window()
def populate(self, pkg_data, critical_txt):
self.__list_model.setStringList(pkg_data)
self.__critical_label.setText(critical_txt)
self.__list_view.update()
示例3: __init__
def __init__(self,parent=None):
super(QtGui.QLineEdit, self).__init__(parent)
model = QStringListModel()
completer = QCompleter()
completer.setModel(model)
model.setStringList(cmd.cmdset)
self.setCompleter(completer)
示例4: __init__
def __init__(self,expdat):
super(DBAnnotateSave, self).__init__()
print("DBAnnotateSave")
uic.loadUi(os.path.join(hs.heatsequerdir,'ui/manualdata.py'), self)
self.bplus.clicked.connect(self.plus)
self.bminus.clicked.connect(self.minus)
self.bontoinput.returnPressed.connect(self.plus)
self.bstudyinfo.clicked.connect(self.studyinfo)
self.bisa.toggled.connect(self.radiotoggle)
self.bdiffpres.toggled.connect(self.radiotoggle)
self.bisatype.currentIndexChanged.connect(self.isatypechanged)
self.bhistory.clicked.connect(self.history)
self.cexp=expdat
self.lnumbact.setText(str(len(expdat.selectedseqs)))
completer = QCompleter()
self.bontoinput.setCompleter(completer)
scdb=hs.scdb
self.scdb=scdb
self.dataid=hs.supercooldb.finddataid(scdb,datamd5=self.cexp.datamd5,mapmd5=self.cexp.mapmd5)
model = QStringListModel()
completer.setModel(model)
# completer.setCompletionMode(QCompleter.InlineCompletion)
completer.maxVisibleItems=10
completer.setCaseSensitivity(Qt.CaseInsensitive)
# make the completer selection also erase the text edit
completer.activated.connect(self.cleartext,type=Qt.QueuedConnection)
# in qt5 should work with middle complete as well...
# completer.setFilterMode(Qt.MatchContains)
if not hs.scdb.ontologyfromid:
hs.scdb=hs.supercooldb.loaddbonto(hs.scdb)
self.ontology=hs.scdb.ontology
self.ontologyfromid=hs.scdb.ontologyfromid
nlist=list(self.ontology.keys())
# nlist=sorted(nlist)
nlist=sorted(nlist, key=lambda s: s.lower())
print("sorted ontology")
model.setStringList(nlist)
self.setWindowTitle(self.cexp.studyname)
try:
tt=hs.lastdatamd5
except:
hs.lastdatamd5=''
if self.cexp.datamd5==hs.lastdatamd5:
self.fillfromcuration(hs.lastcurations[-1],onlyall=True)
self.prefillinfo()
self.bontoinput.setFocus()
示例5: test_flattened_model
def test_flattened_model(self):
model = QStringListModel(["0", "1", "2", "3"])
flat = FlattenedTreeItemModel()
flat.setSourceModel(model)
def get(row):
return flat.index(row, 0).data()
self.assertEqual(get(0), "0")
self.assertEqual(get(1), "1")
self.assertEqual(get(3), "3")
self.assertEqual(flat.rowCount(), model.rowCount())
self.assertEqual(flat.columnCount(), 1)
示例6: __init__
def __init__(self):
super(Person, self).__init__()
self._employer = None
self.id = Person.id_inc
Person.id_inc += 1
self._total_expenses = 0.0
self._net_worth = 0.0
self._name = ''
self.experience = {}
self.shelter = None
self.level_up_type_model = QStringListModel(self.level_up_types)
self.exp_type_model = QStringListModel(self.exp_types)
self.ui = Ui_Person()
self.widget = QWidget()
self.ui.setupUi(self.widget)
self.ui.upgradeComboBox.setModel(self.level_up_type_model)
self.ui.upgradePushButton.clicked.connect(self.upgrade)
self.ui.expComboBox.setModel(self.exp_type_model)
self.ui.expComboBox.activated[str].connect(self.update_experience_widget)
self.ui.nameLineEdit.textEdited.connect(self.name_changed)
self.ui.typeLineEdit.setText(self.TYPE)
self.ui.levelLineEdit.setText(str(self.level))
self.ui.employerLineEdit.setText("Unemployed")
self.ui.netWorthLineEdit.setText(self.display_money(self._net_worth))
self.ui.salaryLineEdit.setText(self.display_money(self.salary))
self.ui.totalIncomeLineEdit.setText(self.display_money(self.total_income))
self.ui.taxesLineEdit.setText(self.display_money(self.income_tax))
self.ui.netLineEdit.setText(self.display_money(self.net))
示例7: __init__
def __init__(self):
WizardPage.__init__(self)
self.fetch_config = None
self.app_model = QStringListModel([a for a in REGISTRY.names()
if not a.startswith('b2g-')])
self.ui.app_combo.setModel(self.app_model)
self.bisect_model = QStringListModel()
self.ui.bisect_combo.setModel(self.bisect_model)
if mozinfo.bits == 64:
if mozinfo.os == 'mac':
self.bits_model = QStringListModel(['64'])
bits_index = 0
else:
self.bits_model = QStringListModel(['32', '64'])
bits_index = 1
elif mozinfo.bits == 32:
self.bits_model = QStringListModel(['32'])
bits_index = 0
self.ui.bits_combo.setModel(self.bits_model)
self.ui.bits_combo.setCurrentIndex(bits_index)
self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config)
self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config)
self.ui.app_combo.setCurrentIndex(
self.ui.app_combo.findText("firefox"))
示例8: IntroPage
class IntroPage(WizardPage):
UI_CLASS = Ui_Intro
TITLE = "Starting a bisection"
SUBTITLE = "Please choose an application and a type of bisection."
FIELDS = {'application': 'app_combo', 'bisect_type': 'bisect_combo',
'find_fix': 'find_fix'}
ID = 0
def __init__(self):
WizardPage.__init__(self)
self.fetch_config = None
self.app_model = QStringListModel(REGISTRY.names())
self.ui.app_combo.setModel(self.app_model)
self.bisect_model = QStringListModel()
self.ui.bisect_combo.setModel(self.bisect_model)
self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config)
self._set_fetch_config(0)
def _set_fetch_config(self, index):
# limit bisection type given the application
old_bisect_index = self.ui.bisect_combo.currentIndex()
self.fetch_config = create_config(
str(self.ui.app_combo.itemText(index)), mozinfo.os, mozinfo.bits)
bisect_types = ['nightlies']
if self.fetch_config.is_inbound():
bisect_types.append('inbound')
self.bisect_model.setStringList(bisect_types)
bisect_index = 0
if old_bisect_index == 1 and len(bisect_types) == 2:
bisect_index = 1
self.ui.bisect_combo.setCurrentIndex(bisect_index)
def validatePage(self):
app_name = self.fetch_config.app_name
launcher_class = LAUNCHER_REGISTRY.get(app_name)
try:
launcher_class.check_is_runnable()
return True
except LauncherNotRunnable, exc:
QMessageBox.critical(
self,
"%s is not runnable" % app_name,
str(exc)
)
return False
示例9: __init__
def __init__(self, parent=None):
QLineEdit.__init__(self, parent)
self.completer = QCompleter()
self.setCompleter(self.completer)
self.model = QStringListModel()
self.completer.setModel(self.model)
#get_data(model)
self.completions = None
self.parent = parent
示例10: __init__
def __init__(self, game, parent=None):
QListView.__init__(self, parent)
self.game = None
self.setWindowTitle(m18n('Explain Scores').replace('&', '') + ' - Kajongg')
self.setGeometry(0, 0, 300, 400)
self.model = QStringListModel()
self.setModel(self.model)
StateSaver(self)
self.refresh(game)
示例11: ed_add_element
def ed_add_element(self):
''' Button 33. Add element '''
# Create the dialog and signals
self.dlg = Add_element()
utils_giswater.setDialog(self.dlg)
self.dlg.btn_accept.pressed.connect(self.ed_add_element_accept)
self.dlg.btn_cancel.pressed.connect(self.close_dialog)
# Manage i18n of the form
self.controller.translate_form(self.dlg, 'element')
# Check if we have at least one feature selected
if not self.ed_check():
return
# Fill combo boxes
self.populate_combo("elementcat_id", "cat_element")
self.populate_combo("state", "value_state")
self.populate_combo("location_type", "man_type_location")
self.populate_combo("workcat_id", "cat_work")
self.populate_combo("buildercat_id", "cat_builder")
self.populate_combo("elementcat_id", "cat_element")
self.populate_combo("ownercat_id", "cat_owner")
self.populate_combo("verified", "value_verified")
# Adding auto-completion to a QLineEdit
self.edit = self.dlg.findChild(QLineEdit, "element_id")
self.completer = QCompleter()
self.edit.setCompleter(self.completer)
model = QStringListModel()
sql = "SELECT DISTINCT(element_id) FROM "+self.schema_name+".element "
row = self.dao.get_rows(sql)
for i in range(0,len(row)):
aux = row[i]
row[i] = str(aux[0])
model.setStringList(row)
self.completer.setModel(model)
# Set signal to reach selected value from QCompleter
self.completer.activated.connect(self.ed_add_el_autocomplete)
# Open the dialog
self.dlg.exec_()
示例12: __init__
def __init__(self):
WizardPage.__init__(self)
self.fetch_config = None
self.app_model = QStringListModel(REGISTRY.names())
self.ui.app_combo.setModel(self.app_model)
self.bisect_model = QStringListModel()
self.ui.bisect_combo.setModel(self.bisect_model)
self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config)
self._set_fetch_config(0)
示例13: create_QNewStrategy
def create_QNewStrategy(self):
self.__q_new_strategy = QNewStrategy()
completer = QCompleter()
if self.get_got_list_instrument_info():
model = QStringListModel()
model.setStringList(self.get_list_instrument_id())
completer.setModel(model)
else:
print(">>> CTPManager.create_QNewStrategy() 查询合约信息失败")
self.__q_new_strategy.lineEdit_a_instrument.setCompleter(completer)
self.__q_new_strategy.lineEdit_b_instrument.setCompleter(completer)
self.__q_new_strategy.set_ClientMain(self.__client_main) # CTPManager设置为新建策略窗口属性
self.__q_new_strategy.set_CTPManager(self) # CTPManager设置为新建策略窗口属性
self.__q_new_strategy.set_SocketManager(self.__socket_manager) # SocketManager设置为新建策略窗口属性
self.__q_new_strategy.set_trader_id(self.__trader_id) # 设置trade_id属性
self.set_QNewStrategy(self.__q_new_strategy) # 新建策略窗口设置为CTPManager属性
self.__client_main.set_QNewStrategy(self.__q_new_strategy) # 新建策略窗口设置为ClientMain属性
self.signal_hide_QNewStrategy.connect(self.get_QNewStrategy().hide) # 绑定信号槽,新创建策略成功后隐藏“新建策略弹窗”
# 绑定信号槽:新建策略窗新建策略指令 -> SocketManager.slot_send_msg
self.__q_new_strategy.signal_send_msg.connect(self.__socket_manager.slot_send_msg)
示例14: __init__
def __init__(self, items):
QSpinBox.__init__(self)
self.setMinimumWidth(75)
self.__string_converter = str
self.__items = items
list = []
for item in self.__items:
assert isinstance(item, CTime)
date = item.date()
list.append(self.convertToString(date))
model = QStringListModel()
model.setStringList(list)
self.setRange(0, len(items) - 1)
self.setValue(len(items) - 1)
line_edit = QLineEdit()
self.setLineEdit(line_edit)
示例15: __init__
def __init__(self):
QMainWindow.__init__(self)
self.setupUi(self)
self.__nodesList = []
self.__nodesModel = QStringListModel(self)
self.nodesView.setModel(self.__nodesModel)
OTPApplication.instance().lastWindowClosed.connect(self._quit)
BootstrapServer.nodeDown.connect(self._nodeDown)
BootstrapServer.nodeUp.connect(self._nodeUp)
BootstrapServer.ready.connect(lambda: self.actionBootstrap.setEnabled(True))
BootstrapServer.notReady.connect(lambda: self.actionBootstrap.setEnabled(False))
QTimer.singleShot(0, self._startup)