Editing Python Desk Top Applications

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 99: Line 99:
  
  
== Singletons ==
+
=== Singletons ===
Most classes are used as singletons, although they may not be coded that way.  There is little to stop programmers from creating multiple instances, but why would they.  Keep in mind an application is not a library. So in addition to AppGlobal we have
+
Most classes are used as singletons, although they may not be coded that way.  There is little to stop programmes from creating multiple instances, but why would they.  Keep in mind an application is not a library. So in addition to AppGlobal we have
  
 
* AppGlobal  -- used as a class, never any instances
 
* AppGlobal  -- used as a class, never any instances
 
* GUI a single instance is the user interface.
 
* GUI a single instance is the user interface.
 
* Main program, controller.  A single instance.
 
* Main program, controller.  A single instance.
* Helper thread Class a single  instance which has most of the hellp thread code, or acts as a controller for the second thread and communicates with the "main" or GUI thread
+
* Helper thread Class a single  instance which has most of the hellp thread code, or acts as a controller for the second thread and communicats with the "main" or GUI thread  
 +
 
  
 
== AppGlobal ==
 
== AppGlobal ==
Line 113: Line 114:
  
 
== RunningOn ==
 
== RunningOn ==
 
+
A new class RunningOn has fairly recently be added to gather information about the platform the system is running on.  This information is later used to adjust the system automatically to run when moved from system to system without any code or parameter changes.  It is a bit tricky because some of the functions it uses and value obtained vary from system to system.  Still seems to work pretty well.
A new class RunningOn has fairly recently be added to gather information about the platform the application is running on.  This information is later used to adjust the application automatically when moved from computer to computer ( including OS changes ) without any code or parameter changes.  It is a bit tricky because some of the functions it uses and value obtained vary from OS to OSSo to test it you need to "move it aroung" some. Still seems to work pretty well.
 
 
   
 
   
 
Variables in RunningOn may be use in parameters to branch based OS or computer name or TCP IP address.  Occasionally values will be used in other code.
 
Variables in RunningOn may be use in parameters to branch based OS or computer name or TCP IP address.  Occasionally values will be used in other code.
  
== Paths and File Names ==
+
=== Paths and File Names ===
 
There are a couple of challenges with paths and file names:
 
There are a couple of challenges with paths and file names:
 
*Are they relative or absolute?
 
*Are they relative or absolute?
Line 143: Line 143:
 
=== Helper Thread in Smart Terminal ===
 
=== Helper Thread in Smart Terminal ===
 
Smart Terminal is fairly typical:  HelperThread in smart_terminal_helper.py  This class provides the support for a second thread of execution that does not block the main thread being run by Tinker.  I call the two threads the GUI Thread (gt) and the Helper Thread ( ht ).  It can get confusing keeping track of which method is running in which thread, I sometimes annotate them with gt and ht.  The helper thread is started by running HelperThread.run() which pretty much just runs a polling task in HelperThread.polling().  HelperThread.polling() is an infinite loop, it uses sleep to set the polling rate.  When used with the green house processing module, it may call a function there that is its own infinite loop.  There are a lot of details here, I should write some more about it.
 
Smart Terminal is fairly typical:  HelperThread in smart_terminal_helper.py  This class provides the support for a second thread of execution that does not block the main thread being run by Tinker.  I call the two threads the GUI Thread (gt) and the Helper Thread ( ht ).  It can get confusing keeping track of which method is running in which thread, I sometimes annotate them with gt and ht.  The helper thread is started by running HelperThread.run() which pretty much just runs a polling task in HelperThread.polling().  HelperThread.polling() is an infinite loop, it uses sleep to set the polling rate.  When used with the green house processing module, it may call a function there that is its own infinite loop.  There are a lot of details here, I should write some more about it.
 
=== Polling ===
 
Both threads have method that perform polling for events often for items in their queue that may have been sent from the other thread.  Info on a similar app in [[Python Smart Terminal Technical Details]].  Polling is also used in some single threaded applications.  Parameters for polling are set in parameters.py
 
  
 
== Parameters ==
 
== Parameters ==
Line 165: Line 162:
 
== DataBase ==
 
== DataBase ==
 
For databases I have used both SQLLite and versions of MySQL.  See application for which one it uses.  I may expand on this section later for now see the code.
 
For databases I have used both SQLLite and versions of MySQL.  See application for which one it uses.  I may expand on this section later for now see the code.
 +
 +
== Polling ==
 +
Both threads have method that perform polling for events often for items in their queue that may have been sent from the other thread.  Info on a similar app in [[Python Smart Terminal Technical Details]].
  
 
== Logging ==
 
== Logging ==
Line 191: Line 191:
  
  
[[Category:Python]] [[Category:Python Projects]] [[Category:SmartTerminal]][[Category:Python SmartPlug]] [[Category:Python Easy DB]] [[Category:ClipBoard]][[Category:Twitter Analysis DB]]
+
[[Category:Python]] [[Category:Python Projects]] [[Category:SmartTerminal]][[Category:Python SmartPlug]] [[Category:Python Easy DB]] [[Category:ClipBoard]]

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)