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


Python QTable.sortColumn方法代码示例

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


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

示例1: sortColumn

# 需要导入模块: from qttable import QTable [as 别名]
# 或者: from qttable.QTable import sortColumn [as 别名]
 def sortColumn(self, col, ascending, wholeRows):
     QTable.sortColumn(self, col, ascending, True)
开发者ID:boudewijnrempt,项目名称:kura,代码行数:4,代码来源:guitable.py

示例2: BrowserBrick

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

#.........这里部分代码省略.........
        self.layout.addWidget(self.main_layout)

        #initially disabled
        self.forward_button.setEnabled(False)
        self.back_button.setEnabled(False)
        #connections
        QObject.connect(self.browser, SIGNAL('backwardAvailable(bool)'),
                        self.back_button.setEnabled)
        QObject.connect(self.browser, SIGNAL('forwardAvailable(bool)'),
                        self.forward_button.setEnabled)
        QObject.connect(self.back_button, SIGNAL('clicked()'),
                        self.browser.backward)
        QObject.connect(self.forward_button, SIGNAL('clicked()'),
                        self.browser.forward)

        self.edna = None


        # resize the splitter to something like 1/4-3/4
#        width = self.main_layout.width()
#        left = width / 4.0
#        right = width - left
#        logging.debug('setting splitter sizes to %d and %d', left, right)
#        self.main_layout.setSizes([left, right])
        
    def sort_column(self, col_number):
        logging.debug('%s: sorting with column %d', self, col_number)
        if col_number == self.sort_column:
            # switch the sort order
            self.sort_order = self.sort_order ^ True
        else:
            self.sort_order = True #else, ascending
            self.sort_column = col_number
        self.history.sortColumn(col_number, self.sort_order, True)

        # put the right decoration on the header label
        if self.sort_order:
            direction = Qt.Ascending
        else:
            direction = Qt.Descending
        self.history.horizontalHeader().setSortIndicator(col_number, direction)

    def load_file(self, path):
        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
开发者ID:douglasbeniz,项目名称:mxcube,代码行数:70,代码来源:BrowserBrick.py

示例3: BrowserBrick

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

#.........这里部分代码省略.........
        header = self.history.horizontalHeader()
        header.setLabel(0, 'Time and date')
        header.setLabel(1, 'Prefix')
        header.setLabel(2, 'Run number')
        
        self.clear_history_button = QPushButton('Clear history', self.history_box)
        self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        QObject.connect(self.clear_history_button, SIGNAL('clicked()'),
                        self.clear_history)

        # Right part of the splitter
        self.browser_box = QWidget(self.main_layout)
        QVBoxLayout(self.browser_box)
        self.browser_box.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)

        self.top_layout = QHBoxLayout(self.browser_box)

        self.back_button = QToolButton(self.browser_box)
        self.back_button.setIconSet(QIconSet(Icons.load('Left2')))
        self.back_button.setTextLabel('Back')
        self.back_button.setUsesTextLabel(True)
        self.back_button.setTextPosition(QToolButton.BelowIcon)
        self.back_button.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum))

        self.forward_button = QToolButton(self.browser_box)
        self.forward_button.setIconSet(QIconSet(Icons.load('Right2')))
        self.forward_button.setTextLabel('Forward')
        self.forward_button.setUsesTextLabel(True)
        self.forward_button.setTextPosition(QToolButton.BelowIcon)
        self.forward_button.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum))

        self.top_layout.addWidget(self.back_button)
        self.top_layout.addWidget(self.forward_button)

        self.browser_box.layout().addLayout(self.top_layout)

        self.browser = QTextBrowser(self.browser_box)
        self.browser.setReadOnly(True)
        self.browser_box.layout().addWidget(self.browser)

        self.layout.addWidget(self.main_layout)

        #initially disabled
        self.forward_button.setEnabled(False)
        self.back_button.setEnabled(False)
        #connections
        QObject.connect(self.browser, SIGNAL('backwardAvailable(bool)'),
                        self.back_button.setEnabled)
        QObject.connect(self.browser, SIGNAL('forwardAvailable(bool)'),
                        self.forward_button.setEnabled)
        QObject.connect(self.back_button, SIGNAL('clicked()'),
                        self.browser.backward)
        QObject.connect(self.forward_button, SIGNAL('clicked()'),
                        self.browser.forward)

        self.edna = None


        # resize the splitter to something like 1/4-3/4
#        width = self.main_layout.width()
#        left = width / 4.0
#        right = width - left
#        logging.debug('setting splitter sizes to %d and %d', left, right)
#        self.main_layout.setSizes([left, right])
        
    def sort_column(self, col_number):
        logging.debug('%s: sorting with column %d', self, col_number)
        if col_number == self.sort_column:
            # switch the sort order
            self.sort_order = self.sort_order ^ True
        else:
            self.sort_order = True #else, ascending
            self.sort_column = col_number
        self.history.sortColumn(col_number, self.sort_order, True)

        # put the right decoration on the header label
        if self.sort_order:
            direction = Qt.Ascending
        else:
            direction = Qt.Descending
        self.history.horizontalHeader().setSortIndicator(col_number, direction)

    def load_file(self, path):
        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, e:
            # can happen when qt sends us the signal with
            # null data and we get the key ("","","")
            pass
开发者ID:MartinSavko,项目名称:mxcube,代码行数:104,代码来源:BrowserBrick.py


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