コード例 #1
0
    def __init__(self):
        WizardPage.__init__(self)
        self.fetch_config = None
        self.app_model = QStringListModel(
            REGISTRY.names(
                lambda klass: not getattr(klass, 'disable_in_gui', None)))
        self.ui.app_combo.setModel(self.app_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.build_type_model = QStringListModel()

        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"))

        completer = QCompleter(sorted(get_branches()), self)
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.ui.repository.setCompleter(completer)
        QApplication.instance().focusChanged.connect(self._on_focus_changed)
コード例 #2
0
    def insertCompletion(self, completion):
        """
        """
        tc = self.textCursor()
        extra = (len(completion) - len(self.completer.completionPrefix()))
        tc.movePosition(QTextCursor.Left)
        tc.movePosition(QTextCursor.EndOfWord)
        tc.insertText(completion[-extra:])
        self.setTextCursor(tc)

        completionPrefix = self.textUnderCursor()
        tc = self.textCursor()
        tc.select(QTextCursor.BlockUnderCursor)

        if tc.selectedText().endswith("[!CACHE:"):
            self.completer.setModel(QStringListModel(self.dataCache, self))
            self.completer.setSuffix(suffix=":]")

            self.refreshPopupCompleter()

        if tc.selectedText().endswith("[!INPUT:"):
            self.completer.setModel(QStringListModel(self.dataInputs, self))
            self.completer.setSuffix(suffix=":]")

            self.refreshPopupCompleter()
コード例 #3
0
    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)
コード例 #4
0
    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)
コード例 #5
0
    def set_completer(self, tablename, widget, field_search, color='black'):
        """ Set autocomplete of widget @table_object + "_id"
            getting id's from selected @table_object
        """

        if not widget:
            return

        # Set SQL
        sql = ("SELECT DISTINCT(" + field_search + ")"
               " FROM " + self.schema_name + "." + tablename + ""
               " ORDER BY " + field_search + "")
        row = self.controller.get_rows(sql)

        for i in range(0, len(row)):
            aux = row[i]
            row[i] = str(aux[0])

        # Set completer and model: add autocomplete in the widget
        self.completer = QCompleter()
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.completer.setCompletionMode(0)
        self.completer.popup().setStyleSheet("color: " + color + ";")
        widget.setCompleter(self.completer)

        model = QStringListModel()
        model.setStringList(row)
        self.completer.setModel(model)
コード例 #6
0
ファイル: DicomBrowser.py プロジェクト: top501/DicomBrowser
    def __init__(self, args, parent=None):
        QtGui.QMainWindow.__init__(self, parent)

        self.srclist = []  # list of source directories
        self.imageIndex = 0  # index of selected image
        self.seriesMap = OrderedDict(
        )  # maps series table row tuples to DicomSeries object it was generated from
        self.seriesColumns = list(seriesListColumns)  # keywords for columns
        self.selectedRow = -1  # selected series row
        self.lastDir = '.'  # last loaded directory root
        self.filterRegex = ''  # regular expression to filter tags by

        # create the directory queue and loading thread objects
        self.dirQueue = Queue()  # queue of directories to load
        self.loadDirThread = threading.Thread(target=self._loadDirsThread)
        self.loadDirThread.daemon = True  # clean shutdown possible with daemon threads
        self.loadDirThread.start(
        )  # start the thread now, it will wait until something is put on self.dirQueue

        # setup ui
        self.setupUi(self)  # create UI elements based on the loaded .ui file
        self.setWindowTitle('DicomBrowser v%s (FOR RESEARCH ONLY)' %
                            (__version__))
        self.setStatus('')

        # connect signals
        self.importButton.clicked.connect(self._openDirDialog)
        self.statusSignal.connect(self.setStatus)
        self.updateSignal.connect(self._updateSeriesTable)
        self.filterLine.textChanged.connect(self._setFilterString)
        self.imageSlider.valueChanged.connect(self.setSeriesImage)
        self.seriesView.clicked.connect(self._seriesTableClicked)

        # setup the list and table models
        self.srcmodel = QStringListModel()
        self.seriesmodel = SeriesTableModel(self.seriesColumns)
        self.seriesmodel.layoutChanged.connect(self._seriesTableResize)
        self.tagmodel = QtGui.QStandardItemModel()

        # assign models to views
        self.sourceListView.setModel(self.srcmodel)
        self.seriesView.setModel(self.seriesmodel)
        self.tagView.setModel(self.tagmodel)

        # create the pyqtgraph object for viewing images
        self.imageview = pg.ImageView()
        layout = QtGui.QGridLayout(self.view2DGroup)
        layout.addWidget(self.imageview)

        # load the empty image placeholder into a ndarray
        qimg = QtGui.QImage(':/icons/noimage.png')
        bytedata = qimg.constBits().asstring(qimg.width() * qimg.height())
        self.noimg = np.ndarray((qimg.width(), qimg.height()),
                                dtype=np.ubyte,
                                buffer=bytedata)

        # add the directories passed as arguments to the directory queue to start loading
        for i in args:
            if os.path.isdir(i):
                self.addSourceDir(i)
コード例 #7
0
    def set_completer_object(self, dialog, table_object):
        """ Set autocomplete of widget @table_object + "_id" 
            getting id's from selected @table_object 
        """
                     
        widget = utils_giswater.getWidget(dialog, table_object + "_id")
        if not widget:
            return
        
        # Set SQL
        field_object_id = "id"
        if table_object == "element":
            field_object_id = table_object + "_id"
        sql = ("SELECT DISTINCT(" + field_object_id + ")"
               " FROM " + self.schema_name + "." + table_object)
        row = self.controller.get_rows(sql, commit=self.autocommit)
        for i in range(0, len(row)):
            aux = row[i]
            row[i] = str(aux[0])

        # Set completer and model: add autocomplete in the widget
        self.completer = QCompleter()
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        widget.setCompleter(self.completer)
        model = QStringListModel()
        model.setStringList(row)
        self.completer.setModel(model)
コード例 #8
0
 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)
コード例 #9
0
    def __init__(self):
        WizardPage.__init__(self)
        self.fetch_config = None
        self.app_model = QStringListModel(
            REGISTRY.names(
                lambda klass: not getattr(klass, 'disable_in_gui', None)))
        self.ui.app_combo.setModel(self.app_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.build_type_model = QStringListModel()

        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"))
コード例 #10
0
ファイル: components.py プロジェクト: B-Rich/entropy
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()
コード例 #11
0
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()
コード例 #12
0
    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)
コード例 #13
0
    def set_completer(self):
        """ Set autocompleters of the form """

        # Adding auto-completion to a QLineEdit - visit_id
        self.completer = QCompleter()
        self.dlg_work.arc_id.setCompleter(self.completer)
        model = QStringListModel()

        model.setStringList(self.selected_list)
        self.completer.setModel(model)
コード例 #14
0
    def mg_mincut_management(self):
        """ Button 27: Mincut management """

        self.action = "mg_mincut_management"

        # Create the dialog and signals
        self.dlg_min_edit = Mincut_edit()
        utils_giswater.setDialog(self.dlg_min_edit)

        self.tbl_mincut_edit = self.dlg_min_edit.findChild(
            QTableView, "tbl_mincut_edit")
        self.txt_mincut_id = self.dlg_min_edit.findChild(
            QLineEdit, "txt_mincut_id")
        self.tbl_mincut_edit.setSelectionBehavior(QAbstractItemView.SelectRows)

        # Adding auto-completion to a QLineEdit
        self.completer = QCompleter()
        self.txt_mincut_id.setCompleter(self.completer)
        model = QStringListModel()

        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".anl_mincut_result_cat "
        rows = self.controller.get_rows(sql)
        values = []
        for row in rows:
            values.append(str(row[0]))

        model.setStringList(values)
        self.completer.setModel(model)
        self.txt_mincut_id.textChanged.connect(
            partial(self.filter_by_id, self.tbl_mincut_edit,
                    self.txt_mincut_id, "anl_mincut_result_cat"))

        self.dlg_min_edit.btn_accept.pressed.connect(self.open_mincut)
        self.dlg_min_edit.btn_cancel.pressed.connect(self.dlg_min_edit.close)
        self.dlg_min_edit.btn_delete.clicked.connect(
            partial(self.delete_mincut_management, self.tbl_mincut_edit,
                    "anl_mincut_result_cat", "id"))

        # Fill ComboBox state
        sql = ("SELECT id"
               " FROM " + self.schema_name + ".anl_mincut_cat_state"
               " ORDER BY id")
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox("state_edit", rows)
        self.dlg_min_edit.state_edit.activated.connect(
            partial(self.filter_by_state, self.tbl_mincut_edit,
                    self.dlg_min_edit.state_edit, "anl_mincut_result_cat"))

        # Set a model with selected filter. Attach that model to selected table
        self.fill_table_mincut_management(
            self.tbl_mincut_edit, self.schema_name + ".anl_mincut_result_cat")
        self.mincut.set_table_columns(self.tbl_mincut_edit,
                                      "anl_mincut_result_cat")

        self.dlg_min_edit.show()
コード例 #15
0
ファイル: plotwingui.py プロジェクト: mortonjt/heatsequer
	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()
コード例 #16
0
    def __init__(self, words):
        super(CompleteLineEdit, self).__init__(None)

        self.words = words                # QStringList  整个完成列表的单词
        self.listView = QListView(self)
        self.model = QStringListModel(self)
        self.listView.setWindowFlags(Qt.ToolTip)

        self.connect(self, SIGNAL("textChanged(const QString &)"),
                     self, SLOT("setCompleter(const QString &)"))

        self.connect(self.listView, SIGNAL("clicked(const QModelIndex &)"),
                     self, SLOT("completeText(const QModelIndex &)"))
コード例 #17
0
    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)
コード例 #18
0
    def __init__(self):
        super(AddNewWord, self).__init__(None)

        self.setWindowTitle("AddNewWord")

        completer = QCompleter(self)
        self.string_list_model = QStringListModel(self)
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        completer.setModel(self.string_list_model)
        self.setCompleter(completer)
        self.connect(self, SIGNAL("editingFinished()"), self.editComplete)

        self.word_list = QStringList()
コード例 #19
0
    def __init__(self, parent=None, settings={}, commands={}):
        super(CommandWindow, self).__init__(parent)

        self.settings = settings
        self.commands = commands

        self.push_button_run = QtGui.QPushButton(self)
        self.push_button_run.setText("Run")
        self.push_button_run.clicked.connect(self.on_push_button_run_clicked)
        self.push_button_run.setAutoDefault(True)

        self.line_edit_command = QtGui.QLineEdit(self)
        self.line_edit_command.returnPressed.connect(
            self.push_button_run.click)

        completer = QCompleter()
        self.line_edit_command.setCompleter(completer)
        self.line_edit_command.setFocus()

        model = QStringListModel()
        completer.setModel(model)

        model.setStringList(self.commands.keys())

        self.message_label = QtGui.QLabel()
        self.message_label.setText("<i>please enter command</i>")
        self.message_label.setStyleSheet("color: #333333")

        self.error_label = QtGui.QLabel()
        self.error_label.setStyleSheet("color: red")
        self.error_label.hide()

        self.output_label = QtGui.QLabel()
        self.output_label.setStyleSheet(
            "font-family: monospace; background-color: #eeeeee; color: green")
        self.output_label.hide()

        self.layoutHorizontal = QtGui.QHBoxLayout()
        self.layoutHorizontal.addWidget(self.line_edit_command)
        self.layoutHorizontal.addWidget(self.push_button_run)

        self.layout_vertical = QtGui.QVBoxLayout(self)
        self.layout_vertical.addWidget(self.message_label)
        self.layout_vertical.addLayout(self.layoutHorizontal)
        self.layout_vertical.addWidget(self.error_label)
        self.layout_vertical.addWidget(self.output_label)

        self.installEventFilter(self)

        # self.resize(640, 480)
        self.center()
コード例 #20
0
    def set_completers(self):
        """ Set autocompleters of the form """

        # Adding auto-completion to a QLineEdit - visit_id
        self.completer = QCompleter()
        self.dlg.visit_id.setCompleter(self.completer)
        model = QStringListModel()

        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".om_visit"
        rows = self.controller.get_rows(sql, commit=self.autocommit)
        values = []
        if rows:
            for row in rows:
                values.append(str(row[0]))

        model.setStringList(values)
        self.completer.setModel(model)

        # Adding auto-completion to a QLineEdit - document_id
        self.completer = QCompleter()
        self.dlg.doc_id.setCompleter(self.completer)
        model = QStringListModel()

        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".v_ui_document"
        rows = self.controller.get_rows(sql, commit=self.autocommit)
        values = []
        if rows:
            for row in rows:
                values.append(str(row[0]))

        model.setStringList(values)
        self.completer.setModel(model)
コード例 #21
0
    def edit_add_element(self):
        """ Button 33: Add element """

        # Create the dialog and signals
        self.dlg = AddElement()
        utils_giswater.setDialog(self.dlg)
        self.set_icon(self.dlg.add_geom, "129")

        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.edit_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("ownercat_id", "cat_owner")
        self.populate_combo("verified", "value_verified")
        self.populate_combo("workcat_id_end", "cat_work")

        # 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)
        self.dlg.add_geom.pressed.connect(self.add_point)

        # Open the dialog
        self.dlg.setWindowFlags(Qt.WindowStaysOnTopHint)
        self.dlg.open()
コード例 #22
0
ファイル: test_dock.py プロジェクト: yisuax11/orange2
    def test_dock_standalone(self):
        widget = QWidget()
        layout = QHBoxLayout()
        widget.setLayout(layout)
        layout.addStretch(1)
        widget.show()

        dock = CollapsibleDockWidget()
        layout.addWidget(dock)
        list_view = QListView()
        list_view.setModel(QStringListModel(["a", "b"], list_view))

        label = QLabel("A label. ")
        label.setWordWrap(True)

        dock.setExpandedWidget(label)
        dock.setCollapsedWidget(list_view)
        dock.setExpanded(True)

        self.app.processEvents()

        def toogle():
            dock.setExpanded(not dock.expanded())
            self.singleShot(2000, toogle)

        toogle()

        self.app.exec_()
コード例 #23
0
ファイル: wizard.py プロジェクト: xennygrimmato/mozregression
    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"))
コード例 #24
0
def set_model_by_list(string_list, widget, proxy_model):
    """ Set the model according to the list """
    model = QStringListModel()
    model.setStringList(string_list)
    proxy_model.setSourceModel(model)
    proxy_model.setFilterKeyColumn(0)
    proxy_model_aux = QSortFilterProxyModel()
    proxy_model_aux.setSourceModel(model)
    proxy_model_aux.setFilterKeyColumn(0)
    widget.setModel(proxy_model_aux)
    widget.setModelColumn(0)
    completer = QCompleter()
    completer.setModel(proxy_model)
    completer.setCompletionColumn(0)
    completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
    widget.setCompleter(completer)
コード例 #25
0
ファイル: Person.py プロジェクト: happy5214/manitae
 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))
コード例 #26
0
 def __init__( self, tableType, widget ):
     super(XOrbSearchCompleter, self).__init__(widget)
     
     # set default properties
     self.setModel(QStringListModel(self))
     self.setCaseSensitivity(Qt.CaseInsensitive)
     self.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
     
     # define custom properties
     self._currentRecord = None
     self._records       = []
     self._tableType     = tableType
     self._baseQuery     = None
     self._order         = None
     self._lastSearch    = ''
     self._cache         = {}
     self._refreshTimer  = QTimer()
     self._limit         = 10 # limited number of search results
     self._pywidget      = widget # need to store the widget as the parent
                                  # to avoid pyside crashing - # EKH 02/01/13
     
     self._refreshTimer.setInterval(500)
     self._refreshTimer.setSingleShot(True)
     
     self._refreshTimer.timeout.connect(self.refresh)
コード例 #27
0
 def get_song_listmodel(self, key=None, parent=None):
     """Create and return a QStringListModel of songs in database
     By default all songs are included
     @param key: Include only songs in given key
     @param key: String
     @return: List model to be passed to QListView
     @type return: QStringListModel"""
     if key == None:
         query = QSqlQuery()
         query.prepare("SELECT song FROM Patterns")
         success = query.exec_()
         if not success:
             pass  # TODO
         songs = [],
         while query.next():
             songs.append(query.value(0))
     else:
         query = QSqlQuery()
         query.prepare("SELECT song FROM Patterns WHERE key == :key")
         query.bindValue(":key", key)
         success = query.exec_()
         if not success:
             pass  # TODO
         songs = [],
         while query.next():
             songs.append(query.value(0))  # Ajatusvirhe
     return QStringListModel(songs, parent)
コード例 #28
0
ファイル: wizard.py プロジェクト: oeekker/mozregression
    def _set_fetch_config(self, index):
        app_name = str(self.ui.app_combo.currentText())
        bits = int(self.ui.bits_combo.currentText())

        self.fetch_config = create_config(app_name, mozinfo.os, bits,
                                          mozinfo.processor)

        self.build_type_model = QStringListModel(
            self.fetch_config.available_build_types())
        self.ui.build_type.setModel(self.build_type_model)

        if not self.fetch_config.available_bits():
            self.ui.bits_combo.hide()
            self.ui.label_4.hide()
        else:
            self.ui.bits_combo.show()
            self.ui.label_4.show()

        # URL doesn't make sense for Thunderbird
        if app_name == 'thunderbird':
            self.ui.url.hide()
            self.ui.url_label.hide()
        else:
            self.ui.url.show()
            self.ui.url_label.show()
コード例 #29
0
    def __init__(self, parent=None):
        super(self.__class__, self).__init__()
        self.parent = parent
        self.setupUi(self)
        self.setWindowTitle("OPC Test Client- Create Group")
        connected_server = connections.server()
        opc.connect(connected_server)
        self.comboData = ['None']
        self.comboBox.addItem(" Select")
        self.treeWidget.setHeaderHidden(True)

        connected_server = connections.server()
        data = connections.read_from_db(connected_server)
        for con1 in data:
            group_list.append(con1[0])
        s_ind = 0
        Tag_list = opc.list('*', recursive=True)
        for x in Tag_list:
            str_list = x.split('.')
            tag = str_list[0]
            if tag in Main_Tags:
                print "Exist"
            else:
                ind = Tag_list.index(x)
                array = Tag_list[s_ind:ind]
                if not array:
                    print "do nothing"
                else:
                    Sub_Tags.append([array])
                Main_Tags.append(tag)
                s_ind = ind
        for y in Main_Tags:
            self.comboBox.addItem(y)
        edit = self.lineEdit_searchTag
        completer = QCompleter()
        edit.setCompleter(completer)
        model = QStringListModel()
        completer.setModel(model)
        self.get_data(model, Tag_list)

        line_g = self.lineEdit_GroupName
        regex = QtCore.QRegExp("[a-z-A-Z-0-9-@-#-$_]+")
        validator = QtGui.QRegExpValidator(regex)
        line_g.setValidator(validator)

        line_update = self.lineEdit_UpdateRate
        regex2 = QtCore.QRegExp("[0-9]+")
        validator2 = QtGui.QRegExpValidator(regex2)
        line_update.setValidator(validator2)

        self.comboBox.activated[str].connect(self.onActivate)
        self.button_cancel.clicked.connect(
            QtCore.QCoreApplication.instance().quit)
        self.button_createGroup.clicked.connect(self.load_tree)
        self.button_searchTag.clicked.connect(self.search)
        self.button_deleteTag.clicked.connect(self.delete_Tag)
        self.connect(self.treeWidget,
                     QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"),
                     self.check_condition)
コード例 #30
0
    def set_model_by_list(self, string_list, widget):

        model = QStringListModel()
        model.setStringList(string_list)
        self.proxy_model = QSortFilterProxyModel()
        self.proxy_model.setSourceModel(model)
        self.proxy_model.setFilterKeyColumn(0)
        proxy_model_aux = QSortFilterProxyModel()
        proxy_model_aux.setSourceModel(model)
        proxy_model_aux.setFilterKeyColumn(0)
        widget.setModel(proxy_model_aux)
        widget.setModelColumn(0)
        completer = QCompleter()
        completer.setModel(self.proxy_model)
        completer.setCompletionColumn(0)
        completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
        widget.setCompleter(completer)
コード例 #31
0
 def populate_comboline(self, dialog, widget, completer):
     _filter = wm.getWidgetText(dialog, widget)
     sql = ("SELECT node_id FROM " + self.schema_name + ".v_edit_node "
            " WHERE node_id ILIKE '%" + str(_filter)+"%'")
     rows = self.controller.get_rows(sql, log_sql=True)
     list_items = [row[0] for row in rows]
     model = QStringListModel()
     self.set_completer_object(completer, model, widget, list_items)
コード例 #32
0
    def __init__(self, tree, dataset, master, parent=None):
        QComboBox.__init__(self, parent)
        Control.__init__(self, tree, dataset, master)

        self.setSelectionMode(QListView.ExtendedSelection)
        model = QStringListModel(self)
        self.setModel(model)
        self.setOptions(tree.subelements_top("Option"))
コード例 #33
0
    def set_completers(self, widget, table_name):
        """ Set autocompleters of the form """

        # Adding auto-completion to a QLineEdit - visit_id
        self.completer = QCompleter()
        widget.setCompleter(self.completer)
        model = QStringListModel()

        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + "." +str(table_name)
        rows = self.controller.get_rows(sql, commit=self.autocommit)
        values = []
        if rows:
            for row in rows:
                values.append(str(row[0]))

        model.setStringList(values)
        self.completer.setModel(model)
コード例 #34
0
ファイル: wizard.py プロジェクト: askeing/mozregression
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
コード例 #35
0
 def __init__(self):
     WizardPage.__init__(self)
     profile_persistence_options = ["clone", "clone-first", "reuse"]
     self.profile_persistence_model = \
         QStringListModel(profile_persistence_options)
     self.ui.profile_persistence_combo.setModel(
         self.profile_persistence_model)
     self.ui.profile_persistence_combo.setCurrentIndex(0)
コード例 #36
0
    def keyPressEvent(self, event):
        """
        """
        if not self.completerMode:
            QTextEdit.keyPressEvent(self, event)
            return

        if self.completer.popup() and self.completer.popup().isVisible():
            if event.key() in (Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape,
                               Qt.Key_Tab, Qt.Key_Backtab):
                event.ignore()
                return

        ## has ctrl-Space been pressed??
        isShortcut = (event.modifiers() == Qt.ControlModifier and\
                      event.key() == Qt.Key_Space)

        if (not self.completer or not isShortcut):
            QTextEdit.keyPressEvent(self, event)

        tc = self.textCursor()
        tc.select(QTextCursor.BlockUnderCursor)
        selectedText = tc.selectedText()

        if selectedText.endswith("[!"):
            self.completer.setModel(
                QStringListModel(["CACHE", "INPUT", "CAPTURE"], self))
            self.completer.setSuffix(suffix=":")

            self.refreshPopupCompleter()

        if selectedText.endswith("[!CACHE:"):
            self.completer.setModel(QStringListModel(self.dataCache, self))
            self.completer.setSuffix(suffix=":]")

            self.refreshPopupCompleter()

        if selectedText.endswith("[!INPUT:"):
            self.completer.setModel(QStringListModel(self.dataInputs, self))
            self.completer.setSuffix(suffix=":]")

            self.refreshPopupCompleter()

        if self.completer.popup().isVisible():
            self.refreshPopupCompleter()
コード例 #37
0
 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
コード例 #38
0
ファイル: scoring.py プロジェクト: ospalh/kajongg-fork
 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)
コード例 #39
0
ファイル: ed.py プロジェクト: Giswater/giswater_qgis_plugin
 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_()    
コード例 #40
0
ファイル: wizard.py プロジェクト: askeing/mozregression
    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)
コード例 #41
0
 def __init__(self, *args, **kwargs):
     separator = kwargs.pop("separator", " ")
     super().__init__(*args, **kwargs)
     self.__tokenList = []
     self.__completerModel = None
     self.__separator = separator
     # The current 'known' completion prefix (tracked in splitPath)
     self.__currentKnownPrefix = ""
     self.setModelSorting(QCompleter.CaseSensitivelySortedModel)
     super().setModel(QStringListModel(self))
コード例 #42
0
ファイル: CTPManager.py プロジェクト: yuwangying/PyCTP
 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)
コード例 #43
0
ファイル: Completion.py プロジェクト: jleahred/miow
 def __init__(self, *args):
     self.model_completer = QStringListModel()
     self.completer = QCompleter(self)
     self.completer.popup().setFont(QFont("Monospace", 11))
     # self.completer.setModelSorting(QCompleter.CaseInsensitivelySortedModel
     self.completer.setCaseSensitivity(Qt.CaseInsensitive)
     self.completer.setWrapAround(False)
     self.completer.setWidget(self)
     self.completer.setCompletionMode(QCompleter.PopupCompletion)
     self.completer.setCaseSensitivity(Qt.CaseInsensitive)
     self.completer.setModel(self.model_completer)
     self.completer.activated.connect(self.insert_completion)
コード例 #44
0
ファイル: ControlPanelWindow.py プロジェクト: Pesa/forse
 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)
コード例 #45
0
ファイル: list_spin_box.py プロジェクト: YingfangZhou/ert
    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)
コード例 #46
0
ファイル: ed.py プロジェクト: Giswater/giswater_qgis_plugin
 def ed_add_file(self):
     ''' Button 34. Add file '''
                     
     # Create the dialog and signals
     self.dlg = Add_file()
     utils_giswater.setDialog(self.dlg)
     self.dlg.btn_accept.pressed.connect(self.ed_add_file_accept)
     self.dlg.btn_cancel.pressed.connect(self.close_dialog)
     
     # Manage i18n of the form
     self.controller.translate_form(self.dlg, 'file')               
     
     # Check if we have at least one feature selected
     if not self.ed_check():
         return
         
     # Fill combo boxes
     self.populate_combo("doc_type", "doc_type")
     self.populate_combo("tagcat_id", "cat_tag")
     
     # Adding auto-completion to a QLineEdit
     self.edit = self.dlg.findChild(QLineEdit, "doc_id")
     self.completer = QCompleter()
     self.edit.setCompleter(self.completer)
     model = QStringListModel()
     sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".doc "
     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_file_autocomplete)
     
     # Open the dialog
     self.dlg.exec_()
コード例 #47
0
ファイル: scoring.py プロジェクト: ospalh/kajongg-fork
class ExplainView(QListView):
    """show a list explaining all score computations"""
    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)

    def refresh(self, game):
        """refresh for new values"""
        self.game = game
        lines = []
        if self.game is None:
            lines.append(m18n('There is no active game'))
        else:
            i18nName = m18n(self.game.ruleset.name)
            lines.append(m18n('Ruleset: %1', i18nName))
            lines.append('')
            for player in self.game.players:
                pLines = []
                if player.hand and player.hand.tileNames:
                    total = player.hand.total()
                    if total:
                        pLines = ['%s: %s' % (player.localName, total)]
                        for line in player.hand.explain():
                            pLines.append('- ' + line)
                elif player.handTotal:
                    pLines.append(m18n('Manual score for %1: %2 points', player.localName, player.handTotal))
                if pLines:
                    pLines.append('')
                lines.extend(pLines)
        if 'xxx'.join(lines) != 'xxx'.join(unicode(x) for x in self.model.stringList()):
            # QStringListModel does not optimize identical lists away, so we do
            self.model.setStringList(lines)
コード例 #48
0
class LineEdit(QLineEdit):
    """Cursom QLineEdit with tab completion"""

    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

    def keyPressEvent(self, event):
        """Handle keypress event"""
        text = self.text()
        if event.key() == Qt.Key_Tab:
            current_text = self.text()
            if current_text != '':
                for item in self.completions:
                    if item.startswith(current_text):
                        self.setText(item)
                        break
            event.accept()
        elif event.key() == Qt.Key_Return:
            if text != '':
                self.window().process_command(text)
                self.setText('')
            event.accept()
        else:
            QLineEdit.keyPressEvent(self, event)            

    def set_completions(self, completions):
        """Set completions"""
        self.completions = completions
        self.model.setStringList(completions)
コード例 #49
0
 def __init__(self, parent=None):
   QMainWindow.__init__(self, parent)
   self.ui = Ui_MainWindow()
   self.ui.setupUi(self)
   QApplication.setQuitOnLastWindowClosed(False)
   self.mod = False
   self.langList = []
   self.flagInfo = str()
   self.flagIcon = str()
   self.currentLayout = str()
   self.cfgInfo = NXkbCfgParser()
   # Lang Model
   self.model = QStringListModel(self.ui.langView)
   self.langFilter = QSortFilterProxyModel()
   # Flag Model
   self.fmodel = QStandardItemModel(self.ui.flagView)
   self.flagFilter = QSortFilterProxyModel()
   # Fill Views
   self.fillViews()
   # Init Lang Model
   self.model.setStringList(self.langList)
   self.langFilter.setSourceModel(self.model)
   self.ui.langView.setModel(self.langFilter)
   # Init Flag Model
   self.flagFilter.setSourceModel(self.fmodel)
   self.ui.flagView.setModel(self.flagFilter)
   # Set both filters to case insensitive
   self.langFilter.setFilterCaseSensitivity(Qt.CaseInsensitive)
   self.flagFilter.setFilterCaseSensitivity(Qt.CaseInsensitive)
   # Connections
   self.ui.lineEdit.textChanged[str].connect(self.langFilter.setFilterFixedString)
   self.ui.lineEdit_2.textChanged[str].connect(self.flagFilter.setFilterFixedString)
   self.ui.buttonBox.button(QDialogButtonBox.Cancel).clicked.connect(self.closeRequest)
   self.ui.flagView.clicked.connect(self.changeFlag)
   self.ui.langView.clicked.connect(self.updateIconDisplay)
   self.ui.addButton.clicked.connect(self.addLayout)
   self.ui.moveUpButton.clicked.connect(self.moveLangUp)
   self.ui.moveDownButton.clicked.connect(self.moveLangDown)
   self.ui.removeButton.clicked.connect(self.removeLang)
   self.ui.buttonBox.button(QDialogButtonBox.Apply).clicked.connect(lambda: self.reloadRequested(self.mod))
   self.ui.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self.okRequest)
   self.ui.browseButton.clicked.connect(self.addCustomIcon)
   # Actions
   self.ui.actionSave.triggered.connect(lambda: self.reloadRequested(self.mod))
   self.ui.actionQuit.triggered.connect(self.closeRequest)
コード例 #50
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.setupUi(self)
     global creds,address
     r=req.get(address+"/send/all",auth=creds,verify=False)
     ls=r.json()
     self.userBox.addItems(ls)
     self.model  = QStringListModel()
     r=req.get(address+"/receive/get/all",auth=creds,verify=False)
     self.files=r.json()
     self.model.setStringList(self.files)
     self.listView.setModel(self.model)
     self.pushButton.clicked.connect(self.openButton)
     self.sendButton.clicked.connect(self.sButton)
     self.getFile.clicked.connect(self.getfile)
     self.exiter.clicked.connect(self.end)
     self.pushButton_2.clicked.connect(self.change)
     self.delete_button.clicked.connect(self.del_file)
コード例 #51
0
ファイル: main.py プロジェクト: juancarlospaco/pylou
 def init(self):
     """Start Pylou Widget."""
     self.layou = QGraphicsLinearLayout(self)
     self.stringlist = QStringList()
     self.model = QStringListModel(self.applet)
     self.model.setStringList(self.stringlist)
     self.treeview = MyTreeView(self)
     self.treeview.setModel(self.model)
     self.lineEdit, self.label = MyLineEdit(self), Plasma.Label(self)
     self.label.setText("Search")
     self.layou.setOrientation(0x2)  # Qt.Vertical
     self.layou.addItem(self.treeview)
     self.layou.addItem(self.label)
     self.layou.addItem(self.lineEdit)
     self.setLayout(self.layou)
     self.lineEdit.returnPressed.connect(self.addItem)
     self.setMinimumSize(200, 99)
     self.setMaximumSize(666, 666)
     # custom user choosed fonts
     user_font_family = QVariant(self.applet.configurations.readEntry(
         "TextFont", QVariant(QFont())))
     self.treeview.nativeWidget().setFont(QFont(user_font_family))
     # custom user choosed styles
     user_style_sheet = "color:{};alternate-background-color:{}".format(
         self.applet.configurations.readEntry("TextColor"),
         self.applet.configurations.readEntry("AlternateBColor"))
     self.treeview.nativeWidget().setStyleSheet(user_style_sheet)
     # Qt connecting people
     Applet.connect(
         self.lineEdit, SIGNAL("keyUPPressed"), self.prevHistoryItem)
     Applet.connect(
         self.lineEdit, SIGNAL("keyDownPressed"), self.nextHistoryItem)
     Applet.connect(self.treeview, SIGNAL("DblClick"), self.openFile)
     Applet.connect(self.treeview, SIGNAL("Click"), self.openDirectory)
     self.applet.appletDestroyed.connect(self.saveHistory)
     # History file
     self.histfile = HISTORY_FILE_PATH
     with open(self.histfile, 'r') as history_file:
         self.history = history_file.readlines()
     self.historyCurrentItem = 0
     self.treeview.nativeWidget().hide()
     self.resize(self.minimumSize())
コード例 #52
0
ファイル: wizard.py プロジェクト: apredator/mozregression
    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)
        if mozinfo.bits == 64:
            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"))
コード例 #53
0
    def __init__(self, *args, **kwargs):
        QLineEdit.__init__(self, *args, **kwargs)
       
        self.completions = []                   # All available completions
        self.googlesuggestions = []             # This will be filled automatically if GOOGLESEARCH is True
        self.partials = []                      # Parsed completions according to partially typed word
        self.staticsuggestions = []             # Static suggestions list
       
        self.cursorpos = 0
        self.wordstart = -1                     # Start of word where cursor positioned
        self.wordend = -1                       # End of word where cursor is positioned
        self.lastindex = -1                     # Last used completion of available completions

        ######################## Completer for first part (without trigger)

        self.completer = QCompleter()
        self.completer.setParent(self)
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.completer.popup().setMinimumHeight(40)           # Keep a minumum heigt if the completer is shown
        self.setCompleter(self.completer)
        self.model = QStringListModel()
        self.model.setParent(self.completer)
        self.completer.setModel(self.model)
        self.completer.setMaxVisibleItems(6)
        self.__set_data(self.model)


        self.setCompletionDialogFoam()            # Set to standard (PopupCompletion)
        self.setKeyWordForCompletion()            # default keyword = "whitespace" - " "

        self.Timer = QTimer()                     # Setup singleshot Timer for GoogleSuggestions
        self.Timer.setSingleShot(True)

        self.setGOOGLESEARCH_attr = False         # initial Settings
        self.languageForGOOGLESEARCH = "en"


        self.textEdited.connect(self.onTextEdit)  # define connections
        self.Timer.timeout.connect(self.googlesearch)

        self.toolButton = None
コード例 #54
0
 def __init__(self):
     super(LevelOnePrimitiveProducer, self).__init__()
     self.employees = []
     self._production_on = False
     self.employee_model = QStringListModel()
     self.hirable_model = QStringListModel()
     
     self.widget = QWidget()
     uic.loadUi('./manitae/units/ui/PrimitiveProducer.ui', self.widget)
     
     self.widget.typeLineEdit.setText(self.UNIT)
     self.widget.levelLineEdit.setText(str(self.level))
     self.widget.nameLineEdit.textEdited.connect(self.name_changed)
     self.widget.fireComboBox.setModel(self.employee_model)
     self.widget.fireButton.clicked.connect(self.fire_employee)
     self.widget.hireComboBox.setModel(self.hirable_model)
     self.widget.hireButton.clicked.connect(self.hire_employee)
     self.widget.prodOnCheckBox.toggled.connect(self.production_on_checked)
     self.widget.employeeLineEdit.setText(str(self.employee_count))
     self.widget.prodOnCheckBox.setChecked(self.production_on)
     self.widget.destroyButton.clicked.connect(self.destroy)
     self.widget.employeeListView.setModel(self.employee_model)
コード例 #55
0
ファイル: wizard.py プロジェクト: KWierso/mozregression
    def __init__(self):
        WizardPage.__init__(self)
        self.fetch_config = None
        self.app_model = QStringListModel([a for a in REGISTRY.names() if a != "b2g-device"])
        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"))
コード例 #56
0
ファイル: components.py プロジェクト: B-Rich/entropy
    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)
コード例 #57
0
ファイル: main.py プロジェクト: juancarlospaco/pylou
class PylouWidget(QGraphicsWidget):

    """Main Widget for Pylou."""

    def __init__(self, parent):
        """Init class."""
        QGraphicsWidget.__init__(self)
        self.applet = parent

    def init(self):
        """Start Pylou Widget."""
        self.layou = QGraphicsLinearLayout(self)
        self.stringlist = QStringList()
        self.model = QStringListModel(self.applet)
        self.model.setStringList(self.stringlist)
        self.treeview = MyTreeView(self)
        self.treeview.setModel(self.model)
        self.lineEdit, self.label = MyLineEdit(self), Plasma.Label(self)
        self.label.setText("Search")
        self.layou.setOrientation(0x2)  # Qt.Vertical
        self.layou.addItem(self.treeview)
        self.layou.addItem(self.label)
        self.layou.addItem(self.lineEdit)
        self.setLayout(self.layou)
        self.lineEdit.returnPressed.connect(self.addItem)
        self.setMinimumSize(200, 99)
        self.setMaximumSize(666, 666)
        # custom user choosed fonts
        user_font_family = QVariant(self.applet.configurations.readEntry(
            "TextFont", QVariant(QFont())))
        self.treeview.nativeWidget().setFont(QFont(user_font_family))
        # custom user choosed styles
        user_style_sheet = "color:{};alternate-background-color:{}".format(
            self.applet.configurations.readEntry("TextColor"),
            self.applet.configurations.readEntry("AlternateBColor"))
        self.treeview.nativeWidget().setStyleSheet(user_style_sheet)
        # Qt connecting people
        Applet.connect(
            self.lineEdit, SIGNAL("keyUPPressed"), self.prevHistoryItem)
        Applet.connect(
            self.lineEdit, SIGNAL("keyDownPressed"), self.nextHistoryItem)
        Applet.connect(self.treeview, SIGNAL("DblClick"), self.openFile)
        Applet.connect(self.treeview, SIGNAL("Click"), self.openDirectory)
        self.applet.appletDestroyed.connect(self.saveHistory)
        # History file
        self.histfile = HISTORY_FILE_PATH
        with open(self.histfile, 'r') as history_file:
            self.history = history_file.readlines()
        self.historyCurrentItem = 0
        self.treeview.nativeWidget().hide()
        self.resize(self.minimumSize())

    def saveHistory(self):
        """Write History to History file."""
        with open(self.histfile, 'w') as history_file:
            history_file.writelines(self.history)

    def prevHistoryItem(self):
        """Navigate the History 1 Item Backwards."""
        if self.historyCurrentItem < len(self.history):
            self.historyCurrentItem = self.historyCurrentItem + 1
        try:
            self.lineEdit.setText(str(self.history[-self.historyCurrentItem]))
        except IndexError as error:
            print(error)
            self.label.setText("ERROR: History Empty.")

    def nextHistoryItem(self):
        """Navigate the History 1 Item Forwards."""
        if self.historyCurrentItem > 1:
            self.historyCurrentItem = self.historyCurrentItem - 1
        try:
            self.lineEdit.setText(str(self.history[-self.historyCurrentItem]))
        except IndexError as error:
            print(error)
            self.label.setText("ERROR: History Empty.")

    def addItem(self):
        """Add Items from Locate command."""
        start_time = datetime.now().second
        self.stringlist.clear()
        lineText = self.lineEdit.text()
        if len(lineText) and str(lineText).strip() not in self.history:
            self.history.append(lineText + "\n")
            self.historyCurrentItem = 1
            self.saveHistory()
        self.historyCurrentItem = self.historyCurrentItem - 1
        command = "ionice --ignore --class 3 chrt --idle 0 "  # Nice CPU / IO
        command += "locate --ignore-case --existing --quiet --limit 9999 {}"
        condition = str(self.applet.configurations.readEntry("Home")) == "true"
        if len(str(lineText).strip()) and condition:
            command_to_run = command.format(  # Only Search inside Home folders
                path.join(path.expanduser("~"), "*{}*".format(lineText)))
        else:
            command_to_run = command.format(lineText)
        locate_output = Popen(command_to_run, shell=True, stdout=PIPE).stdout
        results = tuple(locate_output.readlines())
        banned = self.applet.configurations.readEntry("Banned")
        banned_regex_pattern = str(banned).strip().lower().replace(" ", "|")
        for item in results:
            if not search(banned_regex_pattern, str(item)):  # banned words
                self.stringlist.append(item[:-1])
        purge()  # Purge RegEX Cache
        self.model.setStringList(self.stringlist)
        self.treeview.nativeWidget().resizeColumnToContents(0)
        number_of_results = len(results)
        if number_of_results:  # if tems found Focus on item list
            self.lineEdit.nativeWidget().clear()
            self.label.setText("Found {} results on {} seconds !".format(
                number_of_results, abs(datetime.now().second - start_time)))
            self.resize(500, 12 * number_of_results)
            self.treeview.nativeWidget().show()
            self.treeview.nativeWidget().setFocus()
        else:  # if no items found Focus on LineEdit
            self.label.setText("Search")
            self.resize(self.minimumSize())
            self.treeview.nativeWidget().hide()
            self.lineEdit.nativeWidget().selectAll()
            self.lineEdit.nativeWidget().setFocus()

    def openDirectory(self, index):
        """Take a model index and find the folder name then open the folder."""
        item_to_open = path.dirname(str(self.model.data(index, 0).toString()))
        Popen("xdg-open '{}'".format(item_to_open), shell=True)

    def openFile(self, index):
        """Take a model index and find the filename then open the file."""
        item_to_open = self.model.data(index, 0).toString()
        Popen("xdg-open '{}'".format(item_to_open), shell=True)
コード例 #58
0
ファイル: ControlPanelWindow.py プロジェクト: Pesa/forse
class ControlPanelWindow(QMainWindow, Ui_ControlPanelWindow):

    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)

    @pyqtSlot(name="on_actionBootstrap_triggered")
    def _bootstrap(self):
        self.actionNew.setEnabled(False)
        self.actionBootstrap.setEnabled(False)
        BootstrapServer.bootstrap(self._bootstrapDone, *self.__bootstrapArgs)

    def _bootstrapDone(self, reply):
        if reply == "ok":
            self.statusBar().showMessage("System bootstrapped successfully", 5000)
            self.actionShutdown.setEnabled(True)
        else:
            self.statusBar().showMessage("Bootstrap failed", 5000)
            QMessageBox.critical(self, "Error", "An error occurred during bootstrap:\n\n   %s" % reply)
            self.actionNew.setEnabled(True)
            self.actionBootstrap.setEnabled(True)

    @pyqtSlot(name="on_actionNew_triggered")
    def _newSimulation(self):
        dialog = ConfigDialog(self)
        if dialog.exec_() == ConfigDialog.Accepted:
            self.__bootstrapArgs = dialog.bootstrapArgs()

    def _nodeDown(self, node):
        try:
            self.__nodesList.remove(str(node))
            self.__nodesModel.setStringList(self.__nodesList)
        except ValueError:
            pass

    def _nodeUp(self, node):
        self.__nodesList.append(str(node))
        self.__nodesModel.setStringList(self.__nodesList)

    def _quit(self):
        BootstrapServer.shutdown(lambda _: OTPApplication.quit(), Atom("true"))

    def _setGuiNode(self):
        BootstrapServer.setGuiNode(self._setGuiNodeDone, OTPApplication.nodeName())

    def _setGuiNodeDone(self, reply):
        if reply == "ok":
            QTimer.singleShot(0, self.actionNew.trigger)
        else:
            QTimer.singleShot(500, self._setGuiNode)

    @pyqtSlot(name="on_actionShutdown_triggered")
    def _shutdown(self):
        self.actionShutdown.setEnabled(False)
        BootstrapServer.shutdown(self._shutdownDone, Atom("false"))

    def _shutdownDone(self, reply):
        if reply == "ok":
            self.statusBar().showMessage("System shutdown complete", 5000)
            self.actionNew.setEnabled(True)
        else:
            self.statusBar().showMessage("Shutdown failed", 5000)
            QMessageBox.critical(self, "Error", "An error occurred during shutdown:\n\n   %s" % reply)
            self.actionShutdown.setEnabled(True)

    def _startup(self):
        if BootstrapServer.start():
            self._setGuiNode()
        else:
            QMessageBox.critical(self, "Fatal error", "Failed to start an instance of bootstrap_server.")
            OTPApplication.quit()
コード例 #59
0
ファイル: wizard.py プロジェクト: apredator/mozregression
class IntroPage(WizardPage):
    UI_CLASS = Ui_Intro
    TITLE = "Bisection start"
    SUBTITLE = ("Please choose an application, a type of bisection"
                " and the number of bits for the application.")
    FIELDS = {'application': 'app_combo', 'bisect_type': 'bisect_combo',
              'find_fix': 'find_fix', 'bits': 'bits_combo'}
    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)
        if mozinfo.bits == 64:
            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"))

    def _set_fetch_config(self, index):
        # limit bisection type given the application
        bits = int(self.ui.bits_combo.currentText())
        old_bisect_index = self.ui.bisect_combo.currentIndex()
        self.fetch_config = create_config(
            str(self.ui.app_combo.itemText(index)), mozinfo.os, 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)
        available_bits = self.fetch_config.available_bits()
        if not available_bits:
            self.ui.bits_combo.hide()
            self.ui.label_4.hide()
        else:
            self.ui.bits_combo.show()
            self.ui.label_4.show()

    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