Updated so others can see what's not working ;(

bzr-revno: 109
This commit is contained in:
Martin Thompson 2008-11-21 21:07:52 +00:00
parent f9607e8794
commit 26b8620429
2 changed files with 16 additions and 16 deletions

View File

@ -26,17 +26,18 @@ class ToolbarButton(QtGui.QToolButton):
class Chooser(QtGui.QWidget): class Chooser(QtGui.QWidget):
def __init__(self, parent): def __init__(self, parent):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self)
self.text="Stuff" self.text="Default text"
self.log=logging.getLogger("Chooser")
def paintEvent(self, evt): def paintEvent(self, evt):
self.log.info("Paint")
paint = QtGui.QPainter()#self.choose_area) paint = QtGui.QPainter()#self.choose_area)
paint.begin(self) paint.begin(self)
paint.setPen(QtGui.QColor(168, 34, 3)) paint.setPen(QtGui.QColor(168, 34, 3))
paint.setFont(QtGui.QFont('Decorative', 10)) paint.setFont(QtGui.QFont('Decorative', 10))
paint.drawText(evt.rect(), QtCore.Qt.AlignCenter, self.text) paint.drawText(evt.rect(), QtCore.Qt.AlignCenter, self.text)
paint.end() paint.end()
# self.log.info("done paint") self.log.info("Paint done")
class MediaManagerItem(QtGui.QWidget): class MediaManagerItem(QtGui.QWidget):
name="Default_Item" name="Default_Item"
@ -44,7 +45,7 @@ class MediaManagerItem(QtGui.QWidget):
# can either use an iconname from the resources, or a real image file. # can either use an iconname from the resources, or a real image file.
iconname=None iconname=None
iconfile=os.path.join(mypath, "red-x.png") iconfile=os.path.join(mypath, "red-x.png")
def __init__(self, app): def __init__(self, parent):
self.log=logging.getLogger("MediaMgrItem_%s"%self.name) self.log=logging.getLogger("MediaMgrItem_%s"%self.name)
self.log.info("loaded") self.log.info("loaded")
QtGui.QWidget.__init__(self) QtGui.QWidget.__init__(self)
@ -70,23 +71,22 @@ class MediaManagerItem(QtGui.QWidget):
self.ToolbarButtons=[] self.ToolbarButtons=[]
self.ToolbarButtons.append(ToolbarButton(self, "LoadItem", ":/images/image_load.png", "Load something", "Load something in")) 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")) self.ToolbarButtons.append(ToolbarButton(self, "DeleteItem", ":/images/image_delete.png", "Delete something", "Delete something from"))
# Connect the dots! I mean, slots... # Connect the dots! I mean, slots...
QtCore.QObject.connect(self.ToolbarButtons[0], QtCore.SIGNAL("clicked()"), self.LoadItemclicked) QtCore.QObject.connect(self.ToolbarButtons[0], QtCore.SIGNAL("clicked()"), self.LoadItemclicked)
QtCore.QObject.connect(self.ToolbarButtons[1], QtCore.SIGNAL("clicked()"), self.DeleteItemclicked) QtCore.QObject.connect(self.ToolbarButtons[1], QtCore.SIGNAL("clicked()"), self.DeleteItemclicked)
# add somewhere for "choosing" to happen # add somewhere for "choosing" to happen
self.choose_area=Chooser(self) self.choose_area=Chooser(parent)
self.Layout.addWidget(self.choose_area) self.choose_area.text="Some Stuff"
# self.choose_area_text="Stuff and Nonsense" # xxx uncomment this line and the buttons stop working!
# self.Layout.addWidget(self.choose_area)
def LoadItemclicked(self): def LoadItemclicked(self):
self.log.info("LoadItemClicked") self.log.info("LoadItemClicked")
self.choose_area.text+="+" # self.choose_area.text+="+"
def DeleteItemclicked(self): def DeleteItemclicked(self):
self.log.info("DeleteItemClicked") self.log.info("DeleteItemClicked")
self.choose_area.text+="-" # self.choose_area.text+="-"
def paintEvent(self, evt): def paintEvent(self, evt):
pass pass
self.log.info("done paint")

View File

@ -60,8 +60,8 @@ class TestMediaManager:
log.info("Start") log.info("Start")
# i1=MediaManagerItem() # i1=MediaManagerItem()
# i2=MediaManagerItem() # i2=MediaManagerItem()
i1=MediaManagerItem(self.app) i1=MediaManagerItem(self.MediaToolBox)
i2=MediaManagerItem(self.app) i2=MediaManagerItem(self.MediaToolBox)
i2.choose_area.text="More Stuff" i2.choose_area.text="More Stuff"
log.info("i1"+str(i1)) log.info("i1"+str(i1))
log.info("i2"+str(i2)) log.info("i2"+str(i2))