Repository navigation
Expand file tree
/
Copy pathControlTableView.py
More file actions
66 lines (41 loc) · 1.83 KB
/
Copy pathControlTableView.py
File metadata and controls
66 lines (41 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" pyforms.gui.controls.ControlList
"""
import logging
import os
from pyforms.utils.settings_manager import conf
from AnyQt import QtCore, uic
from AnyQt.QtWidgets import QTableView, QAbstractItemView
from AnyQt.QtGui import QIcon
from pyforms.gui.basewidget import BaseWidget
from pyforms.gui.controls.ControlBase import ControlBase
logger = logging.getLogger(__name__)
class ControlTableView(ControlBase, QTableView):
""" This class represents a wrapper to the table widget
It allows to implement a list view
"""
CELL_VALUE_BEFORE_CHANGE = None # store value when cell is double clicked
def __init__(self, *args, **kwargs):
QTableView.__init__(self)
ControlBase.__init__(self, *args, **kwargs)
if kwargs.get('select_entire_row', False):
self.setSelectionBehavior(QAbstractItemView.SelectRows)
##########################################################################
############ EVENTS ######################################################
##########################################################################
##########################################################################
############ PROPERTIES ##################################################
##########################################################################
@property
def value(self):
return self.model()
@value.setter
def value(self, value):
self.setModel(value)
@property
def form(self):
return self
##########################################################################
############ PRIVATE FUNCTIONS ###########################################
##########################################################################