Re: Even newer wxPython version

Adit Panchal <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
Works great for me.

I also noticed two things on the Mac, wx.Bitmap was switched to use 
Quartz. This gives a lot better quality on the bitmaps. Also the 
toolbars look more native. This means that the workaround for the 
resizing of toolbar images for the Mac can be taken out once the new 
version of wxPython is being used for the builds. Patch is attached.

Additionally, I found out that in the phonebook entry editor, by 
default, nothing is selected when you add a new contact. If you press 
any of the toolbars (with the exception of add) you get an exception of 
an IndexError. I put try and except blocks for these and it takes care 
of the problem.

The best news is that the calendar entry editor finally works for me on 
the Mac. It always brought up an exception when adding a new event. Now 
it works very well.

Thanks,

Adit



On Mar 4, 2005, at 10:56, Roger Binns wrote:

> Robin fixed the bug that crashed us.  I've done a quick
> test of the new version on Windows and it all seems
> to work well.
20050305.diff (application/octet-stream, 3.1 KB)
cvs diff: Diffing .
Index: gui.py
===================================================================
RCS file: /cvsroot/bitpim/bitpim/gui.py,v
retrieving revision 1.168
diff -u -r1.168 gui.py
--- gui.py      3 Mar 2005 07:21:23 -0000       1.168
+++ gui.py      5 Mar 2005 06:08:25 -0000
@@ -565,12 +565,7 @@
 
         ### toolbar
         self.tb=self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_TEXT)
-        # work around a bug in which the Mac toolbar icons are 4 pixels bigger
-        # in each dimension
-        if guihelper.IsMac():
-            self.tb.SetToolBitmapSize(wx.Size(27,27))
-        else:
-            self.tb.SetToolBitmapSize(wx.Size(32,32))
+        self.tb.SetToolBitmapSize(wx.Size(32,32))
         sz=self.tb.GetToolBitmapSize()
 
         # add and delete tools

Index: phonebookentryeditor.py
===================================================================
RCS file: /cvsroot/bitpim/bitpim/phonebookentryeditor.py,v
retrieving revision 1.33
diff -u -r1.33 phonebookentryeditor.py
--- phonebookentryeditor.py     3 Mar 2005 08:35:53 -0000       1.33
+++ phonebookentryeditor.py     5 Mar 2005 06:08:28 -0000
@@ -974,7 +974,7 @@
         ("Ringtones", "ringtones", RingtoneEditor),
         ]
 
-    def __init__(self, parent, data, title="Edit PhoneBook entry", keytoopenon=None, dataindex=None, factory=database.dictdataobjectfactory):
+    def __init__(self, parent, data, title="Edit PhoneBook Entry", keytoopenon=None, dataindex=None, factory=database.dictdataobjectfactory):
         """Constructor for phonebookentryeditor dialog
 
         @param parent: parent window
@@ -989,12 +989,7 @@
         self.data=factory.newdataobject(data)
         vs=wx.BoxSizer(wx.VERTICAL)
         tb=wx.ToolBar(self, 7, style=wx.TB_FLAT|wx.TB_HORIZONTAL|wx.TB_TEXT)
-        # work around a bug in which the mac toolbar icons are 4 pixels bigger
-        # in each dimension
-        if guihelper.IsMac():
-            tb.SetToolBitmapSize(wx.Size(27,27))
-        else:
-            tb.SetToolBitmapSize(wx.Size(32,32))
+        tb.SetToolBitmapSize(wx.Size(32,32))
         sz=tb.GetToolBitmapSize()
         tb.AddLabelTool(self.ID_UP, "Up", wx.ArtProvider.GetBitmap(guihelper.ART_ARROW_UP, wx.ART_TOOLBAR, sz), shortHelp="Move field up")
         tb.AddLabelTool(self.ID_DOWN, "Down", wx.ArtProvider.GetBitmap(guihelper.ART_ARROW_DOWN, wx.ART_TOOLBAR, sz), shortHelp="Move field down")
@@ -1058,17 +1053,25 @@
         return res
             
     def MoveUp(self, _):
-        self.nb.GetPage(self.nb.GetSelection()).Move(-1)
+        try:
+            self.nb.GetPage(self.nb.GetSelection()).Move(-1)
+        except IndexError:
+            pass
     
     def MoveDown(self, _):
-        self.nb.GetPage(self.nb.GetSelection()).Move(+1)
-
+        try:
+            self.nb.GetPage(self.nb.GetSelection()).Move(+1)
+        except IndexError:
+            pass
+            
     def Add(self, _):
         self.nb.GetPage(self.nb.GetSelection()).Add()
 
     def Delete(self, _):
-        self.nb.GetPage(self.nb.GetSelection()).Delete()
-
+        try:
+            self.nb.GetPage(self.nb.GetSelection()).Delete()
+        except IndexError:
+            pass
 
 if __name__=='__main__':
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.