Phone model on status bar

Adit Panchal <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
I know this may be unnecessary and some people might think "What's the 
point, if you just check your settings, you can find it out?" But I 
think it is rather helpful to know what phone model I am currently 
using. I switch between two phones and seeing the phone model in the 
status bar makes it easier to know whether I need to get in the 
preferences to change it.

It would probably also cut down on questions on bitpim-user that relate 
to not changing the default of the LG-VX4400 to the right phone model.

Attached is a diff that should enable it. The only thing is that I 
added two lines when the config is updated in guihelper that will 
update the statusbar after a model change. I think a better way of 
getting the phone model is reading it out of pubsub. Unfortunately, it 
is late for me, and I can't figure out which piece of code subscribes 
to PHONE_MODEL_CHANGED. If I can figure that out, I can redo it so that 
each time that particular subscriber calls PHONE_MODEL_CHANGED, it will 
update the status bar. For now though, the patch works without error.

Thanks,

Adit
phonetype.diff (application/octet-stream, 2 KB)
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 08:33:09 -0000
@@ -679,6 +674,10 @@
         # Retrieve saved settings... Use 90% of screen if not specified
         guiwidgets.set_size("MainWin", self, screenpct=90)
 
+        # Show the current phone model
+        phonetype = "Phone: " + self.config.Read("phonetype")
+        self.SetStatusText(phonetype, 4)
+
         ### Lets go visible
         self.Show()
 
Index: guiwidgets.py
===================================================================
RCS file: /cvsroot/bitpim/bitpim/guiwidgets.py,v
retrieving revision 1.230
diff -u -r1.230 guiwidgets.py
--- guiwidgets.py       1 Mar 2005 05:17:28 -0000       1.230
+++ guiwidgets.py       5 Mar 2005 08:33:13 -0000
@@ -613,6 +613,8 @@
         self.mw.commparams=commparm
         # phone model
         self.mw.config.Write("phonetype", self.phonebox.GetValue())
+        phonetype = "Phone: " + self.mw.config.Read("phonetype")
+        self.mw.SetStatusText(phonetype, 4)
         self.mw.phonemodule=__import__(self.phonemodels[self.phonebox.GetValue()])
         self.mw.phoneprofile=self.mw.phonemodule.Profile()
         pubsub.publish(pubsub.PHONE_MODEL_CHANGED, self.mw.phonemodule)
@@ -1478,8 +1480,9 @@
         wx.EVT_SIZE(self, self.OnSize)
         wx.EVT_IDLE(self, self.OnIdle)
         self.gauge=wx.Gauge(self, 1000, 1)
-        self.SetFieldsCount(4)
-        self.SetStatusWidths( [200, 180, -1, -4] )
+        self.SetFieldsCount(5)
+        self.SetStatusWidths( [200, 180, -2, -5, -3] )
+        self.SetStatusStyles([wx.SB_FLAT,wx.SB_FLAT,wx.SB_FLAT,wx.SB_FLAT, wx.SB_FLAT])
         self.Reposition()
 
     def OnSize(self,_):
@@ -1513,6 +1516,9 @@
         else:
             str=desc
         self.SetStatusText(str,2)
+        
+    def SetPhoneModel(self, desc=""):
+        self.SetStatusText(desc, 4)
 
 ###
 ###  A MessageBox with a help button
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.