当前位置: 首页>>代码示例>>Python>>正文


Python QTable.insertRows方法代码示例

本文整理汇总了Python中qttable.QTable.insertRows方法的典型用法代码示例。如果您正苦于以下问题:Python QTable.insertRows方法的具体用法?Python QTable.insertRows怎么用?Python QTable.insertRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qttable.QTable的用法示例。


在下文中一共展示了QTable.insertRows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: BrowserBrick

# 需要导入模块: from qttable import QTable [as 别名]
# 或者: from qttable.QTable import insertRows [as 别名]

#.........这里部分代码省略.........
        if self.browser.mimeSourceFactory().data(path) == None:
            self.browser.setText('<center>FILE NOT FOUND</center>')
        else:
            self.browser.setSource(abspath(path))

    def history_changed(self, row, col):
        logging.debug('history elem selected: %d:%d', row, col)
        index = (str(self.history.text(row,0)),
                 str(self.history.text(row,1)),
                 str(self.history.text(row,2)))
        try:
            path = self.history_map[index]
            self.load_file(path)
        except KeyError as e:
            # can happen when qt sends us the signal with
            # null data and we get the key ("","","")
            pass

    def new_html(self, html_path, image_prefix, run_number):
	logging.getLogger().debug('got a new html page: %s, prefix: %r, run number: %s', html_path, image_prefix, run_number)

        # prepend the time and date to the path we just got so
        # the history is more readable
        time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

        index = (time_string, str(image_prefix), str(run_number))
        self.history_map[index] = html_path
        # synchronize the history prop
        if self.current_user is not None:
            whole_history = pickle.loads(self.getProperty('history').getValue())
            whole_history[self.current_user] = self.history_map
            self.getProperty('history').setValue(pickle.dumps(whole_history))
                
        self.history.insertRows(self.history.numRows())
        logging.debug('numRows() is %d', self.history.numRows())
        rows = self.history.numRows() - 1

        self.history.setText(rows, 0, QString(time_string))
        self.history.setText(rows, 1, QString(str(image_prefix)))
        self.history.setText(rows, 2, QString(str(run_number)))

        logging.debug('numRows() is %d', self.history.numRows())

        self.load_file(html_path)
    
    def clear_history(self):
        self.history_map.clear()
        self.history.setNumRows(0)

    def propertyChanged(self, prop, oldval, newval):
        if prop == 'mnemonic':
            logging.getLogger().debug('BrowserBrick: using edna object %s', newval)
            if self.edna is not None:
                self.disconnect(self.edna, PYSIGNAL('newEDNAHTML'), self.new_html)
            self.edna = self.getHardwareObject(newval)
            logging.getLogger().debug('edna object is now: %s', self.edna)
            self.connect(self.edna, PYSIGNAL('newEDNAHTML'), self.new_html)
    
    def run(self):
        pass

    def login_changed(self, session_id,prop_code=None,prop_number=None,prop_id=None,expiration_time=0):
        logging.debug('BrowserBrick::login_changed: login changed to %r', session_id)
        if session_id is None:
            # user logged out
            logging.debug('user logged out')
开发者ID:douglasbeniz,项目名称:mxcube,代码行数:70,代码来源:BrowserBrick.py


注:本文中的qttable.QTable.insertRows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。