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


Python QTable.setLeftMargin方法代码示例

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


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

示例1: ParametersTable

# 需要导入模块: from qttable import QTable [as 别名]
# 或者: from qttable.QTable import setLeftMargin [as 别名]
class ParametersTable(QWidget):
    def __init__(self, parent = None, name = "parameter_table"):
        QWidget.__init__(self, parent, name)

        self.__dc_parameters = None

        self.add_dc_cb = None

        self.parameters_label = QLabel(self, "parameters_label")

        self.parameter_table = QTable(self, "parameter_table")
        self.parameter_table.setNumCols(3)
        self.parameter_table.horizontalHeader().\
            setLabel(0, self.__tr("Name"), -1)
        self.parameter_table.horizontalHeader().\
            setLabel(1, self.__tr("Value"))
        self.parameter_table.verticalHeader().hide()
        self.parameter_table.horizontalHeader().setClickEnabled(False, 0);
        self.parameter_table.horizontalHeader().setClickEnabled(False, 1);
        self.parameter_table.setColumnWidth(0, 200)
        self.parameter_table.setColumnWidth(1, 200)
        self.parameter_table.hideColumn(2)
        self.parameter_table.setColumnReadOnly(0, True)
        self.parameter_table.setLeftMargin(0)
        self.parameter_table.setNumRows(0)
        self.position_label = QLabel("Positions", self, "position_view")
        self.position_label.setAlignment(Qt.AlignTop)

##        self.add_button = QPushButton(self, "add_button")
        #self.add_button.setDisabled(True)

        h_layout = QGridLayout(self, 1, 2)
        v_layout_position = QVBoxLayout(self)
        v_layout_position.addWidget(self.position_label)
        v_layout_table = QVBoxLayout(self)
        h_layout.addLayout(v_layout_table, 0, 0)
        h_layout.addLayout(v_layout_position, 0, 1)
        v_layout_table.addWidget(self.parameters_label)
        v_layout_table.addWidget(self.parameter_table)
##        v_layout_table.addWidget(self.add_button)
    
##        self.languageChange()

        
##        QObject.connect(self.add_button, SIGNAL("clicked()"),
##                        self.__add_data_collection)

        QObject.connect(self.parameter_table, 
                        SIGNAL("valueChanged(int, int)"), 
                        self.__parameter_value_change)

        #self.populate_parameter_table(self.__dc_parameters)
        
        
##    def languageChange(self):
##        self.add_button.setText("Add")


    def __tr(self, s, c = None):
        return qApp.translate("parameter_table", s, c)


    def __add_data_collection(self):
        return self.add_dc_cb(self.__dc_parameters, self.collection_type)


    def populate_parameter_table(self, parameters):
        self.parameter_table.setNumRows(11)
        i = 0
        for param_key, parameter in parameters.items():

            if param_key != 'positions':
                self.parameter_table.setText(i, 0, parameter[0])
                self.parameter_table.setText(i, 1, parameter[1])
                self.parameter_table.setText(i, 2, param_key)
                i += 1

##     def add_positions(self, positions):
##         self.__dc_parameters['positions'].extend(positions)
        

    def __parameter_value_change(self, row, col):
        self.__dc_parameters[str(self.parameter_table.item(row, 2).text())][1] = \
            str(self.parameter_table.item(row, 1).text())
开发者ID:MAXLABMX,项目名称:mxcube,代码行数:86,代码来源:parameter_table_widget.py

示例2: BrowserBrick

# 需要导入模块: from qttable import QTable [as 别名]
# 或者: from qttable.QTable import setLeftMargin [as 别名]
class BrowserBrick(BaseComponents.BlissWidget):
    def __init__(self, *args):
        BaseComponents.BlissWidget.__init__(self, *args)

        #map displayed string in the history list -> actual file path
        self.history_map = dict()

        self.layout = QVBoxLayout(self)

        self.defineSlot('load_file', ())
        self.defineSlot('login_changed', ())
        self.addProperty('mnemonic', 'string', '')
        self.addProperty('history', 'string', '', hidden=True)
        self.addProperty('sessions ttl (in days)', 'integer', '30')

        #make sure the history property is a pickled dict
        try:
            hist = pickle.loads(self.getProperty('history').getValue())
        except: # EOFError if the string is empty but let's not count on it
            self.getProperty('history').setValue(pickle.dumps(dict()))

        # maybe defer that for later
        self.cleanup_history()

        self.main_layout = QSplitter(self)
        self.main_layout.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding))

        # left part of the splitter
        self.history_box = QVBox(self.main_layout)
        self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

        self.sort_order = True

        self.sort_col = None

        self.history = QTable(self.history_box)
	self.history.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding))
        self.history.setSelectionMode(QTable.SingleRow)
        self.history.setNumCols(3)
        self.history.verticalHeader().hide()
        self.history.setLeftMargin(0)
        self.history.setSorting(False)
        QObject.connect(self.history,
                        SIGNAL('currentChanged(int,int)'),
                        self.history_changed)
    
        #by default sorting only sorts the columns and not whole rows.
        #let's reimplement that
        QObject.connect(self.history.horizontalHeader(),
                        SIGNAL('clicked(int)'),
                        self.sort_column)

        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)
#.........这里部分代码省略.........
开发者ID:douglasbeniz,项目名称:mxcube,代码行数:103,代码来源:BrowserBrick.py

示例3: BrowserBrick

# 需要导入模块: from qttable import QTable [as 别名]
# 或者: from qttable.QTable import setLeftMargin [as 别名]
class BrowserBrick(BaseComponents.BlissWidget):
    def __init__(self, *args):
        BaseComponents.BlissWidget.__init__(self, *args)

        #map displayed string in the history list -> actual file path
        self.history_map = dict()

        self.layout = QVBoxLayout(self)

        self.defineSlot('load_file', ())
        self.defineSlot('login_changed', ())
        self.addProperty('mnemonic', 'string', '')
        self.addProperty('history', 'string', '', hidden=True)
        self.addProperty('sessions ttl (in days)', 'integer', '30')

        #make sure the history property is a pickled dict
        try:
            hist = pickle.loads(self.getProperty('history').getValue())
        except: # EOFError if the string is empty but let's not count on it
            self.getProperty('history').setValue(pickle.dumps(dict()))

        # maybe defer that for later
        self.cleanup_history()

        self.main_layout = QSplitter(self)
        self.main_layout.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding))

        # left part of the splitter
        self.history_box = QVBox(self.main_layout)
        self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

        self.sort_order = True

        self.sort_col = None

        self.history = QTable(self.history_box)
        self.history.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding))
        self.history.setSelectionMode(QTable.SingleRow)
        self.history.setNumCols(3)
        self.history.verticalHeader().hide()
        self.history.setLeftMargin(0)
        self.history.setSorting(False)
        QObject.connect(self.history,
                        SIGNAL('currentChanged(int,int)'),
                        self.history_changed)
    
        #by default sorting only sorts the columns and not whole rows.
        #let's reimplement that
        QObject.connect(self.history.horizontalHeader(),
                        SIGNAL('clicked(int)'),
                        self.sort_column)

        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)
#.........这里部分代码省略.........
开发者ID:MartinSavko,项目名称:mxcube,代码行数:103,代码来源:BrowserBrick.py


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