# HG changeset patch # User cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1237426851 0 # Node ID 68ae8f4234ca2ab2b498cf9aa252ba8d34b27ca0 # Parent 2a80f7d9aede1c8d47283c9e69cf587f50594fc9 * More compact ObjectSelector dialog diff -r 2a80f7d9aede -r 68ae8f4234ca clients/editor/plugins/objectselector.py --- a/clients/editor/plugins/objectselector.py Tue Mar 17 23:47:56 2009 +0000 +++ b/clients/editor/plugins/objectselector.py Thu Mar 19 01:40:51 2009 +0000 @@ -21,36 +21,29 @@ def buildGui(self): # Create the main Window self.gui = widgets.Window(title="Object selector") - hbox = widgets.HBox() - self.gui.addChild(hbox) + vbox = widgets.VBox() + self.gui.addChild(vbox) - # Add the Scrollarea with list of namespaces - scrollArea = widgets.ScrollArea(size=(200,300)) - hbox.addChild(scrollArea) - self.namespaces = widgets.ListBox() + # Add the drop down with list of namespaces + self.namespaces = widgets.DropDown() + vbox.addChild(self.namespaces) self.namespaces.capture(self.update_namespace) self.namespaces.items = self.engine.getModel().getNamespaces() self.namespaces.selected = 0 - scrollArea.addChild(self.namespaces) - # This Vbox is used to display the preview images - self.mainScrollArea = widgets.ScrollArea(size=(200,300)) + # This scrollarea is used to display the preview images + self.mainScrollArea = widgets.ScrollArea(size=(230,300)) self.objects = None if self.mode == 'list': self.setTextList() else: # Assuming self.mode is 'preview' self.setImageList() - hbox.addChild(self.mainScrollArea) + vbox.addChild(self.mainScrollArea) - # This is the preview area - scrollArea = widgets.ScrollArea(size=(200,300)) - hbox.addChild(scrollArea) - self.preview = widgets.Icon() - scrollArea.addChild(self.preview) # Add another Hbox to hold the close button hbox = widgets.HBox(parent=self.gui) - self.gui.addChild(hbox) + vbox.addChild(hbox) hbox.addSpacer(widgets.Spacer()) toggleButton = widgets.Button(text="Toggle Preview Mode") toggleButton.capture(self.toggleMode) @@ -59,6 +52,13 @@ closeButton.capture(self.hide) hbox.addChild(closeButton) + # This is the preview area + scrollArea = widgets.ScrollArea(size=(230,1)) + vbox.addChild(scrollArea) + self.preview = widgets.Icon() + scrollArea.addChild(self.preview) + scrollArea._setBackgroundColor(self.gui._getBaseColor()) + def toggleMode(self): if self.mode == 'list': self.setImageList() @@ -120,6 +120,9 @@ been selected. @param obj: fife.Object instance""" self.preview.image = self._getImage(obj) + height = self.preview.image.getHeight(); + if height > 200: height = 200 + self.preview._getParent()._setHeight(height) self.gui.adaptLayout() self.notify(obj)