parent
7be47240fc
commit
78bac1e35c
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from PySide import QtGui
|
||||
|
||||
class Check(QtGui.QWidget):
|
||||
|
||||
def __init__(self):
|
||||
super(Check, self).__init__()
|
||||
|
||||
self.initUI()
|
||||
|
||||
def initUI(self):
|
||||
|
||||
self.lbl = QtGui.QLabel("Ubuntu", self)
|
||||
combo = QtGui.QComboBox(self)
|
||||
combo.addItem("Ubuntu")
|
||||
combo.addItem("Mandriva")
|
||||
combo.addItem("Fedora")
|
||||
combo.addItem("Red Hat")
|
||||
combo.addItem("Gentoo")
|
||||
|
||||
combo.move(50, 50)
|
||||
self.lbl.move(50, 150)
|
||||
|
||||
combo.activated[str].connect(self.onActivated)
|
||||
|
||||
self.setGeometry(0, 0, 150, 180)
|
||||
self.setWindowTitle('QtGui.QComboBox')
|
||||
self.show()
|
||||
|
||||
def onActivated(self, text):
|
||||
if text == 'Gentoo':
|
||||
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(50, 150)
|
||||
self.lbl.show()
|
||||
self.lbl.setText(text)
|
||||
self.lbl.adjustSize()
|
||||
|
||||
class MainFrame (QtGui.QScrollArea):
|
||||
def __init__(self, parent):
|
||||
QtGui.QScrollArea.__init__(self)
|
||||
# верхнее правое
|
||||
check2 = Check()
|
||||
self.setWidget(check2)
|
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PySide import QtGui
|
||||
|
||||
class MainMenu():
|
||||
def __init__(self, parent):
|
||||
exitAction = QtGui.QAction(QtGui.QIcon('image/Exit.png'), '&Exit', parent)
|
||||
exitAction.setShortcut('Ctrl+Q')
|
||||
exitAction.setStatusTip('Exit application')
|
||||
exitAction.triggered.connect(parent.close)
|
||||
|
||||
parent.toolbar = parent.addToolBar('Exit')
|
||||
parent.toolbar.addAction(exitAction)
|
||||
# menubar = parent.menuBar()
|
||||
# fileMenu = menubar.addMenu('&File')
|
||||
# fileMenu.addAction(exitAction)
|
@ -0,0 +1,55 @@
|
||||
# -*- 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.setWindowTitle('QtGui.QComboBox')
|
||||
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)
|
||||
|
||||
tempbox3.addWidget(self.scrollArea3)
|
||||
self.setLayout(tempbox3)
|
||||
|
||||
check3.combo.activated[str].connect(parent.statusbar.showMessage)
|
Loading…
Reference in new issue