Got some text in the "choosing area"

bzr-revno: 94
This commit is contained in:
Martin Thompson 2008-11-17 20:37:25 +00:00
parent 3f684a2a4d
commit b6edf96d32
2 changed files with 18 additions and 7 deletions

View File

@ -21,6 +21,7 @@ class ToolbarButton(QtGui.QToolButton):
self.setToolTip(QtGui.QApplication.translate("main_window", tooltiptext, None, QtGui.QApplication.UnicodeUTF8))
self.setText(QtGui.QApplication.translate("main_window", tooltiptext, None, QtGui.QApplication.UnicodeUTF8))
self.setStatusTip(QtGui.QApplication.translate("main_window", statustip, None, QtGui.QApplication.UnicodeUTF8))
# xxx button events
class MediaManagerItem(QtGui.QWidget):
log=logging.getLogger("MediaMgrItem")
@ -30,30 +31,39 @@ class MediaManagerItem(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.log.info("init")
self.setGeometry(QtCore.QRect(0, 0, 267, 609))
# self.setObjectName("%sPage"%self.name)
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(self.iconname), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setGeometry(QtCore.QRect(0,0,267,609))
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)
self.Layout.setMargin(0)
# self.Layout.setObjectName("Layout")
# setup toolbar
self.Toolbar = QtGui.QWidget(self)
# self.Toolbar.setObjectName("%sToolbar"%self.name)
self.ToolbarLayout = QtGui.QHBoxLayout(self.Toolbar)
self.ToolbarLayout.setSpacing(0)
self.ToolbarLayout.setMargin(0)
# self.ToolbarLayout.setObjectName("%sToolbarLayout"%self.name)
self.log.info("Adding toolbar item")
self.ToolbarButtons=[]
self.ToolbarButtons.append(ToolbarButton(self, "LoadItem", ":/images/image_load.png", "Load something", "Load something in"))
self.ToolbarButtons.append(ToolbarButton(self, "DeleteItem", ":/images/image_delete.png", "Delete something", "Delete something from"))
# add somewhere for "choosing" to happen
self.choose_area=QtGui.QWidget(self)
self.Layout.addWidget(self.choose_area)
self.choose_area.text="Stuff and Nonsense"
def paintEvent(self, evt):
paint = QtGui.QPainter()#self.choose_area)
paint.begin(self)
paint.setPen(QtGui.QColor(168, 34, 3))
paint.setFont(QtGui.QFont('Decorative', 10))
paint.drawText(evt.rect(), QtCore.Qt.AlignCenter, self.choose_area.text)
paint.end()
# add items
# self.LoadItem = QtGui.QToolButton(self.Toolbar)
# icon17 = QtGui.QIcon()

View File

@ -25,7 +25,7 @@ class TestMediaManager:
self.app = QtGui.QApplication([])
logging.info ("App is " + str(self.app))
self.main_window = QtGui.QMainWindow()
self.main_window.resize(800, 600)
self.main_window.resize(200, 600)
# self.StatusBar = QtGui.QStatusBar(self.main_window)
# self.StatusBar.setObjectName("StatusBar")
# self.main_window.setStatusBar(self.StatusBar)
@ -60,6 +60,7 @@ class TestMediaManager:
log.info("Start")
i1=MediaManagerItem()
i2=MediaManagerItem()
i2.choose_area.text="More Stuff"
log.info("i1"+str(i1))
log.info("i2"+str(i2))
self.MediaToolBox.addItem(i1, i1.icon, "Test1")