From 26b86204298158bb0a987a50bf7660fb76d7c422 Mon Sep 17 00:00:00 2001 From: Martin Thompson Date: Fri, 21 Nov 2008 21:07:52 +0000 Subject: [PATCH] Updated so others can see what's not working ;( bzr-revno: 109 --- openlp/plugins/mediamanageritem.py | 28 ++++++++++---------- openlp/plugins/test/test_mediamanageritem.py | 4 +-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/openlp/plugins/mediamanageritem.py b/openlp/plugins/mediamanageritem.py index 76e017515..93b048ac9 100644 --- a/openlp/plugins/mediamanageritem.py +++ b/openlp/plugins/mediamanageritem.py @@ -26,17 +26,18 @@ class ToolbarButton(QtGui.QToolButton): class Chooser(QtGui.QWidget): def __init__(self, parent): - QtGui.QWidget.__init__(self, parent) - self.text="Stuff" - + QtGui.QWidget.__init__(self) + self.text="Default text" + self.log=logging.getLogger("Chooser") def paintEvent(self, evt): + self.log.info("Paint") 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.text) paint.end() -# self.log.info("done paint") + self.log.info("Paint done") class MediaManagerItem(QtGui.QWidget): name="Default_Item" @@ -44,7 +45,7 @@ class MediaManagerItem(QtGui.QWidget): # can either use an iconname from the resources, or a real image file. iconname=None 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.info("loaded") QtGui.QWidget.__init__(self) @@ -70,23 +71,22 @@ class MediaManagerItem(QtGui.QWidget): 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")) - # Connect the dots! I mean, slots... QtCore.QObject.connect(self.ToolbarButtons[0], QtCore.SIGNAL("clicked()"), self.LoadItemclicked) QtCore.QObject.connect(self.ToolbarButtons[1], QtCore.SIGNAL("clicked()"), self.DeleteItemclicked) # add somewhere for "choosing" to happen - self.choose_area=Chooser(self) - self.Layout.addWidget(self.choose_area) -# self.choose_area_text="Stuff and Nonsense" - - + self.choose_area=Chooser(parent) + self.choose_area.text="Some Stuff" + # xxx uncomment this line and the buttons stop working! +# self.Layout.addWidget(self.choose_area) + def LoadItemclicked(self): self.log.info("LoadItemClicked") - self.choose_area.text+="+" +# self.choose_area.text+="+" def DeleteItemclicked(self): self.log.info("DeleteItemClicked") - self.choose_area.text+="-" +# self.choose_area.text+="-" def paintEvent(self, evt): pass - + self.log.info("done paint") diff --git a/openlp/plugins/test/test_mediamanageritem.py b/openlp/plugins/test/test_mediamanageritem.py index 1a73ac1a5..22113707b 100644 --- a/openlp/plugins/test/test_mediamanageritem.py +++ b/openlp/plugins/test/test_mediamanageritem.py @@ -60,8 +60,8 @@ class TestMediaManager: log.info("Start") # i1=MediaManagerItem() # i2=MediaManagerItem() - i1=MediaManagerItem(self.app) - i2=MediaManagerItem(self.app) + i1=MediaManagerItem(self.MediaToolBox) + i2=MediaManagerItem(self.MediaToolBox) i2.choose_area.text="More Stuff" log.info("i1"+str(i1)) log.info("i2"+str(i2))