Version: 9.16.0
Item.py
Go to the documentation of this file.
1# Copyright (C) 2006-2026 CEA, EDF
2#
3# This library is free software; you can redistribute it and/or
4# modify it under the terms of the GNU Lesser General Public
5# License as published by the Free Software Foundation; either
6# version 2.1 of the License, or (at your option) any later version.
7#
8# This library is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11# Lesser General Public License for more details.
12#
13# You should have received a copy of the GNU Lesser General Public
14# License along with this library; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16#
17# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18#
19
20import sys
21from qt import *
22from . import CONNECTOR
23from . import adapt
24
25class Item:
26 def __init__(self,label=""):
27 self.label=label
28 self.emitting=0
29
30 def isExpandable(self):
31 return False
32
33 def getChildren(self):
34 return []
35 def father(self):
36 return None
37
38 def getIconName(self):
39 return "python"
40
41 def panel(self,parent):
42 """Retourne un widget pour browser/editer l'item"""
43 qvbox=QVBox(parent)
44 label=QLabel("Default Panel",qvbox)
45 label.setAlignment( Qt.AlignHCenter | Qt.AlignVCenter )
46 return qvbox
47
48 def box(self,parent):
49 """Retourne un widget pour browser/editer l'item"""
50 qvbox=QVBox(parent)
51 label=QLabel("Default Panel",qvbox)
52 label.setAlignment( Qt.AlignHCenter | Qt.AlignVCenter )
53 return qvbox
54
55 def selected(self):
56 """Method called on selection"""
57 #print "Item selected"
58 def dblselected(self):
59 """Method called on double selection"""
60 #print "Item dblselected"
61
62ADAPT=adapt.adapt
63items={}
64def adapt(obj):
65 if obj.ptr() in items:
66 return items[obj.ptr()]
67 else:
68 item= ADAPT(obj,Item)
69 items[obj.ptr()]=item
70 return item
71
72if __name__ == "__main__":
73 app = QApplication(sys.argv)
74 t=Item("label").panel(None)
75 app.setMainWidget(t)
76 t.show()
77 app.exec_loop()
78
def isExpandable(self)
Definition: Item.py:30
def __init__(self, label="")
Definition: Item.py:26
def getIconName(self)
Definition: Item.py:38
def box(self, parent)
Definition: Item.py:48
def dblselected(self)
Definition: Item.py:58
def panel(self, parent)
Definition: Item.py:41
def father(self)
Definition: Item.py:35
def selected(self)
Definition: Item.py:55
def getChildren(self)
Definition: Item.py:33
def adapt(obj)
Definition: Item.py:64