You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-utils-3-console-gui/api/gui/statusfield.py

55 lines
1.6 KiB

# -*- coding: utf-8 -*-
from PySide import QtGui
class Checkbox(QtGui.QWidget):
def __init__(self):
super(Checkbox, self).__init__()
self.initUI()
def initUI(self):
self.lbl = QtGui.QLabel("Town", self)
self.combo = QtGui.QComboBox(self)
self.combo.addItem("Town")
self.combo.addItem("City")
self.combo.addItem("Village")
self.combo.move(50, 50)
self.lbl.move(150, 50)
self.combo.activated[str].connect(self.onActivated)
self.setGeometry(50, 50, 200, 100)
self.show()
def onActivated(self, text):
if text == 'Village':
if hasattr (self, 'lbl'): #if 'lbl' in self:
self.lbl.hide()
del self.lbl
else:
if not hasattr (self, 'lbl'):
self.lbl = QtGui.QLabel(text, self)
self.lbl.move(150, 50)
self.lbl.show()
self.lbl.setText(text)
self.lbl.adjustSize()
class StatusField (QtGui.QFrame):
def __init__(self, parent):
# создание нижнего фрейма
# bottom = QtGui.QFrame(self)
QtGui.QFrame.__init__(self)
tempbox3 = QtGui.QHBoxLayout(self)
check3 = Checkbox()
self.scrollArea3 = QtGui.QScrollArea()
self.scrollArea3.horizontalScrollBar().hide()
self.scrollArea3.setWidget(check3)
# self.resize(800,10)
tempbox3.addWidget(self.scrollArea3)
self.setLayout(tempbox3)
check3.combo.activated[str].connect(parent.statusbar.showMessage)