-
Notifications
You must be signed in to change notification settings - Fork 0
/
zonelisttab.py
76 lines (67 loc) · 3.24 KB
/
zonelisttab.py
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
67
68
69
70
71
72
73
74
75
76
# -*- coding: utf-8 -*-
"""***************************************************************************
* Copyright (C) 2009 by Derek Kite *
* dkite@shaw.ca *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************"""
from PyQt4 import QtGui, QtCore
import sys
import dimensionscene
import dimensionwidget
class zoneListTab(QtGui.QWidget):
def __init__(self,scene,parent=None):
QtGui.QWidget.__init__(self,parent)
self.scene = scene
zonegblayout = QtGui.QVBoxLayout()
hhlayout = QtGui.QHBoxLayout()
hhlayout.addWidget(QtGui.QLabel('Enter Zone Name:'))
self.zonename = QtGui.QLineEdit()
hhlayout.addWidget(self.zonename)
self.zonenamebutton = QtGui.QPushButton('Add &Zone')
hhlayout.addWidget(self.zonenamebutton)
zonegblayout.addLayout(hhlayout)
self.zonelist = QtGui.QComboBox()
zonegblayout.addWidget(self.zonelist)
self.dimensions = dimensionwidget.dimensionWidget(scene)
zonegblayout.addWidget(self.dimensions)
zonegblayout.addStretch()
self.setLayout(zonegblayout)
self.connect(self.zonenamebutton, QtCore.SIGNAL('clicked ( bool)'),self.zonenamebuttonclicked)
self.connect(self.zonelist,QtCore.SIGNAL('currentIndexChanged (int)'),self.zonelistchanged)
self.zonenamebutton.setEnabled(False)
self.zonelist.setEnabled(False)
self.zonename.setEnabled(False)
def zonenamebuttonclicked(self):
print 'zonenamebutton'
if not self.zonename.text() == '':
print self.zonearray
print self.currentfloor
self.zonearray[self.currentfloor].append(str(self.zonename.text()))
self.zonelist.addItem(self.zonename.text())
self.zonename.setText('')
def zonelistchanged(self,i):
print 'zonelistchanged'
print self.segmentarray
#update segments
self.floorzone = self.currentfloor+':'+str(self.zonelist.itemText(i))
self.dimensiontitle.setText(self.floorzone)
print self.floorzone
if self.floorzone in self.segmentarray:
self.currentsegmentlist = self.segmentarray[self.floorzone]
else:
self.currentsegmentlist = []
self.linesegments.setText(self.buildSegmentStr())