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


Python QtCore.QAbstractTableModel类代码示例

本文整理汇总了Python中PyQt4.QtCore.QAbstractTableModel的典型用法代码示例。如果您正苦于以下问题:Python QAbstractTableModel类的具体用法?Python QAbstractTableModel怎么用?Python QAbstractTableModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, parent=None, fileName="data.json", *args):
        """ 
        load data from  json file fileName
        """
        QAbstractTableModel.__init__(self, parent, *args)
        self.dataFile = fileName
        self.header = [u"标记", u"名字", u"分类", u"进/出货", u"价格", u"时间", u"备注", u"图片"]
        self.headerLiteral = ["ID", "Name", "Type", "Category", "Price", "Time", "Comments", "Pic"]

        dataArray = []
        if os.access(self.dataFile, os.F_OK):
            self._jsonData = json.load(codecs.getreader("utf-8")(open(self.dataFile)))
        else:
            self._jsonData = []
        for data in self._jsonData:
            id, info = data["id"], data["contents"]
            dataArray.append(
                [
                    id,
                    info["name"],
                    info["type"],
                    info["category"],
                    info["price"],
                    info["date"],
                    info["comments"],
                    info["pic"],
                ]
            )
        self.dataArray = dataArray

        self.defaultData = [1, u"name", u"type", u"cat", u"price", u"time", u"comments", u"pics"]
开发者ID:skyscribe,项目名称:financial,代码行数:31,代码来源:DataController.py

示例2: __init__

 def __init__(self,parent):
     QAbstractTableModel.__init__(self,parent)
     
     self.sensors_ports_keys = []
     self.sensors_ports = []        
     self.client_core = ClientCore.get_instance()
     self.setup_connections()
开发者ID:juanchitot,项目名称:domo,代码行数:7,代码来源:sensors_model.py

示例3: __init__

 def __init__(self, parent, market, preferences, headerdata):
     QAbstractTableModel.__init__(self, parent)
     self.market = market
     self.preferences = preferences
     self.market.signal_orderbook_changed.connect(self.slot_changed)
     self.headerdata = headerdata
     self._data = []
开发者ID:genbtc,项目名称:goxgui,代码行数:7,代码来源:model.py

示例4: __init__

    def __init__(self, directory=".",  model=None, fake_branch_name="",
                 parent=None, remote_ref=None):
        """
            Initializes the git model with the repository root directory.

            Here, we allow the QGitEditableModel to set the GitModel used.
            We do that in order to reduce the number of GitModel instanciated.

            :param directory:
                Root directory of the git repository.

            :param model:
                As given by QGitEditableModel.get_model().get_orig_model().

        """
        QAbstractTableModel.__init__(self, parent)
        if not model:
            self.git_model = GitModel(directory=directory,
                                      remote_ref=remote_ref)
        else:
            self.git_model = model
        self._filters = {}
        self._enabled_options = []
        self._directory = directory
        self._parent = parent
开发者ID:mike-perdide,项目名称:gitbuster,代码行数:25,代码来源:q_git_model.py

示例5: __init__

    def __init__(self, elements=None, parent=None):
        '''
        Common interface for the labelListModel and the boxListModel
        see concrete implementations for details

        :param elements:
        :param parent:
        '''
        QAbstractTableModel.__init__(self, parent)

        if elements is None:
            elements = []
        self._elements = list(elements)
        self._selectionModel = QItemSelectionModel(self)

        def onSelectionChanged(selected, deselected):


            if selected:
                ind = selected[0].indexes()
                if len(ind)>0:
                    self.elementSelected.emit(ind[0].row())

        self._selectionModel.selectionChanged.connect(onSelectionChanged)

        self._allowRemove = True
        self._toolTipSuffixes = {}

        self.unremovable_rows=[] #rows in this list cannot be removed from the gui,
开发者ID:burcin,项目名称:ilastik,代码行数:29,代码来源:listModel.py

示例6: flags

 def flags(self, index):
     if not index.isValid():
         return Qt.ItemIsEnabled
     if self.isColumn("round", index) or self.isColumn("adjRating", index):
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
     return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
                         Qt.ItemIsEditable)
开发者ID:Whatang,项目名称:QBetty,代码行数:7,代码来源:RaceModel.py

示例7: __init__

    def __init__(self, parent, preferences, signal_clicked):
        QAbstractTableModel.__init__(self, parent)

        # initialize data array with empty strings
        self.__data = [['' for i in range(self.__COLS)] for j in range(self.__ROWS)]  # @UnusedVariable @IgnorePep8

        # initialize color array with default color
        self.__color = [[self.__COLOR_DEFAULT for i in range(self.__COLS)] for j in range(self.__ROWS)]  # @UnusedVariable @IgnorePep8

        self.__preferences = preferences

        # initialize non-changing cell texts and colors
        self.__set_data(0, 0, "Crypto balance:")
        self.__set_data(1, 0, "Fiat balance:")
#         self.__set_color(0, 0, self.__COLOR_BALANCE)
#         self.__set_color(0, 1, self.__COLOR_BALANCE)
#         self.__set_color(1, 0, self.__COLOR_BALANCE)
#         self.__set_color(1, 1, self.__COLOR_BALANCE)

        self.__set_data(0, 2, "Trading lag:")
        self.__set_color(0, 2, self.__COLOR_ORDERLAG)
        self.__set_color(0, 3, self.__COLOR_ORDERLAG)
        self.__set_color(1, 2, self.__COLOR_ORDERLAG)
        self.__set_color(1, 3, self.__COLOR_ORDERLAG)

        self.__set_data(0, 4, "Bid:")
        self.__set_data(1, 4, "Ask:")
#         self.__set_color(0, 4, self.__COLOR_BID_ASK)
#         self.__set_color(0, 5, self.__COLOR_BID_ASK)
#         self.__set_color(1, 4, self.__COLOR_BID_ASK)
#         self.__set_color(1, 5, self.__COLOR_BID_ASK)

        # listen for clicks
        signal_clicked.connect(self.__slot_clicked)
开发者ID:dkgeorge,项目名称:goxgui,代码行数:34,代码来源:info.py

示例8: __init__

 def __init__(self, parent=None):
     QAbstractTableModel.__init__(self, parent)
     self.data = []
     self.cat_ids = {}
     self.data_lock = Lock()
     self.feature_ids = {}
     self.feature_id_seq = 0
开发者ID:DigitalGlobe,项目名称:DGConnect,代码行数:7,代码来源:CatalogDialogTool.py

示例9: __init__

 def __init__(self, transactions):
     QAbstractTableModel.__init__(self)
     self.transactions = transactions
     self.HEADERS = [self.tr("Type"),
                     self.tr("Date"),
                     self.tr("Shares @\nPrice"),
                     self.tr("Value +\nCommission")]
开发者ID:shinghei,项目名称:MaeMoney,代码行数:7,代码来源:TransactionsModelPortrait.py

示例10: __init__

    def __init__(self, tasks):
        QAbstractTableModel.__init__(self)
        self.tasks = tasks
        self.tasks_data = []
        self.last_sort_column = 0
        self.last_sort_order = Qt.AscendingOrder
        self.header = ['#',
                        'Sma',
                        'Rs',
                        'Rp',
                        'Ts',
                        'Tp',
                        'Inc.',
                        'Darkening law',
                        'chi^2']

        for task in tasks:
            self.tasks_data.append([task.id,
                                    task.input.semi_major_axis,
                                    task.input.star_radius,
                                    task.input.planet_radius,
                                    task.input.star_temperature,
                                    task.input.planet_temperature,
                                    task.input.inclination,
                                    task.input.darkening_law + '(' + str(task.input.darkening_1) + ', ' + str(task.input.darkening_2) + ')',
                                    task.result.chi2])
开发者ID:avladev,项目名称:transit-gui,代码行数:26,代码来源:Layout.py

示例11: __init__

    def __init__ (self, collaggr=None, songs=None, view=None):
        QAbstractTableModel.__init__ (self, view)
        # TODO: different delegate for editing tags: one with completion
        self.view_= view
        self.playlist= view.playlist
        self.edited= False

        if songs is None:
            self.collaggr= collaggr
            self.collections= self.collaggr.collections

            self.signalMapper= QSignalMapper ()
            for collNo, collection in enumerate (self.collections):
                collection.newSongs.connect (self.signalMapper.map)
                self.signalMapper.setMapping (collection, collNo)

            self.signalMapper.mapped.connect (self.addRows)
        else:
            self.collaggr= CollectionAggregator (self, songs=songs)

        self.attrNames= ('artist', 'year', 'collection', 'diskno', 'album', 'trackno', 'title', 'length', 'filepath')

        self.headers= (u'Artist', u'Year', u'Collection', u'CD', u'Album', u'Track', u'Title', u'Length', u'Path')
        # FIXME: kinda hacky
        self.fontMetrics= QFontMetrics (KGlobalSettings.generalFont ())
        # FIXME: (even more) hackish
        self.columnWidths= ("M"*15, "M"*4, "M"*15, "M"*3, "M"*20, "M"*3, "M"*25, "M"*5, "M"*200)
        logger.debug ("QPLM: ", self)
开发者ID:StyXman,项目名称:satyr,代码行数:28,代码来源:complex.py

示例12: __init__

 def __init__(self, questions_answers, parent):
     QAbstractTableModel.__init__(self, parent)
     self.questions_answers = questions_answers
     self.incorrect = self.get_incorrect_questions_answers()
     self.rows_count = len(self.incorrect)
     self.columns_count = self.COLUMNS_COUNT
     self.columns_names = [self.FIRST_COLUMN, self.SECOND_COLUMN, self.THIRD_COLUMN, ]
开发者ID:BStalewski,项目名称:lanler,代码行数:7,代码来源:main_model.py

示例13: __init__

 def __init__(self):
     QAbstractTableModel.__init__(self)
     self.__arrowDown = QIcon(":/icons/arrow-down.png")
     self.__arrowUp = QIcon(":/icons/arrow-up.png")
     self.__positions = {}
     handlers = {('init', 'standings'): self._standingsInit,
                 ('update', 'standings'): self._standingsUpdate}
     OTPApplication.registerMsgHandlers(handlers)
开发者ID:Pesa,项目名称:forse,代码行数:8,代码来源:PositionsModel.py

示例14: __init__

 def __init__(self, distObjects, parent=None):
     """Init TracepointModel
     """
     QAbstractTableModel.__init__(self, parent)
     QItemDelegate.__init__(self, parent)
     self.tracepoints = []
     self.distObjects = distObjects
     self.connector = distObjects.gdb_connector
开发者ID:gledr,项目名称:ricodebug,代码行数:8,代码来源:tracepointmodel.py

示例15: __init__

 def __init__(self):
     QAbstractTableModel.__init__(self)
     self.__data = {}
     self.__intermediate = None
     self.__lap = None
     handlers = {('init', 'chrono'): self._chronoInit,
                 ('update', 'chrono'): self._chronoUpdate}
     OTPApplication.registerMsgHandlers(handlers)
开发者ID:Pesa,项目名称:forse,代码行数:8,代码来源:TelemetryModel.py


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