Author: ks156
Date: 2009-09-28 09:26:54 +0200 (Mon, 28 Sep 2009)
New Revision: 5506

Modified:
   
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/tools.css
   
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window-ie6.css
   
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window.css
   
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/js/common.js
   
software_suite_v3/smart-core/smart-server/branches/user_mode/delphi_launchers/restart/restart.pas
   
software_suite_v3/smart-core/smart-server/branches/user_mode/delphi_launchers/smart_server_restart.exe
   
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/02_robot/10_resourceRF.py
   
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
   
software_suite_v3/smart-core/smart-server/branches/user_mode/translation/wi_user/de.po
   
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/gadget/Gadget.py
   
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/PluginParameter.py
   
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/interpreters/PluginInterpreter.py
   
software_suite_v3/smart-core/smart-server/branches/user_mode/util/i18n/I18n.py
   
software_suite_v3/smart-core/smart-server/branches/user_mode/util/system/Device.py
Log:
* Merged rev 5491 to 5505 from trunk to user_mode

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/tools.css
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/tools.css
       2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/tools.css
       2009-09-28 07:26:54 UTC (rev 5506)
@@ -58,7 +58,7 @@
     display:table;
     float:left;
     line-height:34px;
-    font-size:10px;
+    font-size:9px;
     color:#FFFFFF;
     text-align:center;
     vertical-align:middle;
@@ -98,7 +98,7 @@
     margin-left:10px;
     width:54px;
     _width:72px;
-    padding-left:18px;
+    padding-left:22px;
     
background-image:url(/data/web_interface/user_01/img/gadgets_btn_show_enable.png);
 }
 
@@ -109,14 +109,14 @@
 .toolsBtnShowActivate{
     width:54px;
     _width:72px;
-    padding-left:18px;
+    padding-left:22px;
     
background-image:url(/data/web_interface/user_01/img/gadgets_btn_show_activate.png);
 }
 
 .toolsBtnShowDisable{
     width:54px;
     _width:72px;
-    padding-left:18px;
+    padding-left:22px;
     
background-image:url(/data/web_interface/user_01/img/gadgets_btn_show_disable.png);
 }
 

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window-ie6.css
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window-ie6.css
  2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window-ie6.css
  2009-09-28 07:26:54 UTC (rev 5506)
@@ -72,7 +72,7 @@
     margin-top:6px;
     padding-top:-1px;
     line-height:34px;
-    font-size:10px;
+    font-size:9px;
     color:#FFFFFF;
     text-align:center;
     vertical-align:middle;

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window.css
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window.css
      2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/css/window.css
      2009-09-28 07:26:54 UTC (rev 5506)
@@ -72,7 +72,7 @@
     margin-top:6px;
     padding-top:-1px;
     line-height:34px;
-    font-size:10px;
+    font-size:9px;
     color:#FFFFFF;
     text-align:center;
     vertical-align:middle;

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/js/common.js
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/js/common.js
        2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/data/web_interface/user_01/js/common.js
        2009-09-28 07:26:54 UTC (rev 5506)
@@ -11,7 +11,7 @@
  */
 function setpng(img)
 {
-    if (document.all && 
(IEver=parseFloat(navigator.appVersion.split("MSIE")[1])) && (IEver>=5.5) && 
(IEver<7) && document.body.filters && img)
+    if (document.all && 
(IEver=parseFloat(navigator.appVersion.split("MSIE")[1])) && (IEver>=5.5) && 
(IEver<=8) && document.body.filters && img)
     {
         var imgName = img.src.toUpperCase();
         if (imgName.substring(imgName.length-3,imgName.length) == "PNG")

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/delphi_launchers/restart/restart.pas
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/delphi_launchers/restart/restart.pas
   2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/delphi_launchers/restart/restart.pas
   2009-09-28 07:26:54 UTC (rev 5506)
@@ -27,7 +27,6 @@
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs,
   shellApi,
-  tlhelp32,
   Registry;
 
 const
@@ -52,33 +51,6 @@
 
 {$R *.dfm}
 
-{**
- *
- *}
-function GetTask(ExeFileName: string): integer;
-const
-  PROCESS_TERMINATE = $0001;
-var
-  ContinueLoop: BOOL;
-  FSnapshotHandle: THandle;
-  FProcessEntry32: TProcessEntry32;
-begin
-  Result := 0;
-  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
-  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
-  while Integer(ContinueLoop) <> 0 do
-  begin
-    if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = 
UpperCase(ExeFileName)) or
-         (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
-    begin
-      Result := FProcessEntry32.th32ProcessID;
-    end;
-    ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
-  end;
-  CloseHandle(FSnapshotHandle);
-end;
-
 {*
  * \brief Get the Tuxdroid installation path from the registry.
  * \return The Tuxdroid installation path.
@@ -112,27 +84,9 @@
     HWND(nil),
     nil,
     PChar(tuxdroid_path + '\softwares\python2.4\pythonForTuxdroid.exe'),
-    PChar(format('"%s" --stop', [serverFileName])),
+    PChar(format('"%s" --restart', [serverFileName])),
     PChar(format('"%s"', [serverPath])),
     SW_HIDE);
-  for i := 0 to 15 do
-  begin
-    if GetTask('pythonForTuxdroid.exe') <> 0 then
-    begin
-      application.ProcessMessages;
-      sleep(500);
-    end else
-    begin
-      break;
-    end;
-  end;
-  ShellExecute(
-    HWND(nil),
-    nil,
-    PChar(tuxdroid_path + '\softwares\python2.4\pythonForTuxdroid.exe'),
-    PChar(format('"%s" --start', [serverFileName])),
-    PChar(format('"%s"', [serverPath])),
-    SW_HIDE);
   application.Terminate;
 end.
  
\ No newline at end of file

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/delphi_launchers/smart_server_restart.exe
===================================================================
(Binary files differ)

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/02_robot/10_resourceRF.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/02_robot/10_resourceRF.py
    2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/02_robot/10_resourceRF.py
    2009-09-28 07:26:54 UTC (rev 5506)
@@ -93,6 +93,8 @@
         self.__flagsMutex = threading.Lock()
         self.__channelInUse = None
         self.__connectionDetected = False
+        self.__chanCycleMap = [1, 6, 11]
+        self.__currentChanCycleIdx = 0
         defaultConfiguration = {
             'avoided_channel' : None,
             'avoided_bandwidth' : WIFI_DEFAULT_AVOIDED_BANDWIDTH,
@@ -150,34 +152,27 @@
     def statesChecker(self):
         userChannel = self.configurator.getConfiguration()['avoided_channel']
         userBandwidth = 
self.configurator.getConfiguration()['avoided_bandwidth']
-        if self.__channelIsInUse() == None:
+        if self.__channelIsInUse() != None:
+            self.avoidChannel(self.__channelIsInUse(), userBandwidth)
+        else:
             if userChannel != None:
                 self.logger.logInfo("Manual wifi channel avoidance : ch=%d 
bw=%d" % (userChannel, userBandwidth))
                 self.avoidChannel(userChannel, userBandwidth)
                 self.__setChannelInUse(userChannel)
                 self.__setConnectionDetected(True)
             else:
-                """
-                if URLTools.URLCheck("http://ftp.kysoh.com";, 5.0):
-                    detectedChannel = self.detectChannel()
-                    if detectedChannel != None:
-                        print "Avoid auto detected channel :", detectedChannel
-                        self.avoidChannel(detectedChannel, 
WIFI_DEFAULT_AVOIDED_BANDWIDTH)
-                        self.__setChannelInUse(detectedChannel)
-                        self.__setConnectionDetected(True)
-                    else:
-                        print "Can't detect wifi channel, default is 1"
-                        self.avoidChannel(1, WIFI_DEFAULT_AVOIDED_BANDWIDTH)
-                        self.__setChannelInUse(1)
-                        self.__setConnectionDetected(True)
-                """
-                # Don't detect internet connection seems to have better results
                 detectedChannel = self.detectChannel()
                 if detectedChannel != None:
                     self.logger.logInfo("Automatic wifi channel avoidance : 
ch=%d" % detectedChannel)
                     self.avoidChannel(detectedChannel, 
WIFI_DEFAULT_AVOIDED_BANDWIDTH)
                     self.__setChannelInUse(detectedChannel)
                     self.__setConnectionDetected(True)
+                else:
+                    chan = self.__chanCycleMap[self.__currentChanCycleIdx]
+                    self.__currentChanCycleIdx += 1
+                    if self.__currentChanCycleIdx >= len(self.__chanCycleMap):
+                        self.__currentChanCycleIdx = 0
+                    self.avoidChannel(chan, WIFI_DEFAULT_AVOIDED_BANDWIDTH)
 
     def resetStates(self):
         self.logger.logInfo("Reset wifi channel avoidance states")

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
 2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
 2009-09-28 07:26:54 UTC (rev 5506)
@@ -587,15 +587,6 @@
             messages = pguContext.getMessagesHistory()
             result['count'] = len(messages)
             for i, message in enumerate(messages):
-                """
-                if not String.isUtf8(message):
-                    try:
-                        tmp = message.decode("latin-1", "ignore")
-                        message = tmp.encode("utf-8", "ignore")
-                    except:
-                        pass
-                message = String.toUtf8(message)
-                """
                 result['msg_%d' % i] = message
             return result
         self.__bfPguContextMutex.acquire()

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/translation/wi_user/de.po
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/translation/wi_user/de.po
      2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/translation/wi_user/de.po
      2009-09-28 07:26:54 UTC (rev 5506)
@@ -155,7 +155,7 @@
 msgstr "Selten"
 
 msgid "show"
-msgstr "Anzeigen"
+msgstr "Zeigen"
 
 msgid "online_documentation"
 msgstr "Online-Dokumentation"

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/gadget/Gadget.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/gadget/Gadget.py
        2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/gadget/Gadget.py
        2009-09-28 07:26:54 UTC (rev 5506)
@@ -60,6 +60,8 @@
                 else:
                     if os.name == "nt":
                         gadgetParameter.setVisible('false')
+            # Set gadget as parent for translations
+            gadgetParameter.setParentForTranslations(self)
             self.__parameters.append(gadgetParameter)
         # Set the default value and visibility of the parameters
         if dictionary.has_key('parameters'):
@@ -435,9 +437,12 @@
             SUPPORTED_LANGUAGES_LIST.append(language)
         for language in SUPPORTED_LANGUAGES_LIST:
             i18n = I18n()
-            i18n.setPoDirectory(self.__workingPath)
             i18n.setLocale(language)
+            
i18n.setPoDirectory(os.path.join(self.__parentPlugin.getWorkingPath(),
+                "resources"))
             i18n.update()
+            i18n.setPoDirectory(self.__workingPath)
+            i18n.update()
             self.__i18nList[language] = i18n
 
     # 
--------------------------------------------------------------------------

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/PluginParameter.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/PluginParameter.py
       2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/PluginParameter.py
       2009-09-28 07:26:54 UTC (rev 5506)
@@ -26,6 +26,7 @@
         @param dictionary: Parameter as dictionary.
         """
         self.__parent = parent
+        self.__parentForTranslations = parent
         self.__dictionary = dictionary
         self.__name = None
         self.__type = None
@@ -105,6 +106,15 @@
         return self.__parent
 
     # 
--------------------------------------------------------------------------
+    # Set the parent object for translations.
+    # 
--------------------------------------------------------------------------
+    def setParentForTranslations(self, parent):
+        """Set the parent object for translations.
+        @param parent: Gadget or Plugin object.
+        """
+        self.__parentForTranslations = parent
+
+    # 
--------------------------------------------------------------------------
     # Get the parameter data as dictionary.
     # 
--------------------------------------------------------------------------
     def getDictionary(self):
@@ -143,7 +153,7 @@
         if language == None:
             return self.__defaultValue
         else:
-            return self.__parent.tr2(language, self.__defaultValue)
+            return self.__parentForTranslations.tr2(language, 
self.__defaultValue)
 
     # 
--------------------------------------------------------------------------
     # Set the default value.
@@ -162,9 +172,9 @@
         @return: A string.
         """
         if language == None:
-            return self.__parent.tr(self.__description)
+            return self.__parentForTranslations.tr(self.__description)
         else:
-            return self.__parent.tr2(language, self.__description)
+            return self.__parentForTranslations.tr2(language, 
self.__description)
 
     # 
--------------------------------------------------------------------------
     # Get the translated name.
@@ -174,9 +184,9 @@
         @return: A string.
         """
         if language == None:
-            return self.__parent.tr(self.__name)
+            return self.__parentForTranslations.tr(self.__name)
         else:
-            return self.__parent.tr2(language, self.__name)
+            return self.__parentForTranslations.tr2(language, self.__name)
 
     # 
--------------------------------------------------------------------------
     # Get the category.
@@ -195,9 +205,9 @@
         @return: A string.
         """
         if language == None:
-            return self.__parent.tr(self.__enumValues)
+            return self.__parentForTranslations.tr(self.__enumValues)
         else:
-            return self.__parent.tr2(language, self.__enumValues)
+            return self.__parentForTranslations.tr2(language, 
self.__enumValues)
 
     # 
--------------------------------------------------------------------------
     # Get the untranslated value of an enumerated value.
@@ -214,9 +224,13 @@
                 idx = i
                 break
         if idx != -1:
-            return self.__enumValuesList[idx]
+            try:
+                result = self.__enumValuesList[idx]
+            except:
+                result = translatedValue
+            return result
         else:
-            return self.__enumValuesList[0]
+            return translatedValue
 
     # 
--------------------------------------------------------------------------
     # Get the minimal value.

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/interpreters/PluginInterpreter.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/interpreters/PluginInterpreter.py
        2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/applicationserver/plugin/interpreters/PluginInterpreter.py
        2009-09-28 07:26:54 UTC (rev 5506)
@@ -295,6 +295,11 @@
             self.__onPluginStartedCallback()
         while self.__getRun():
             line = self.__process.stdout.readline()
+            try:
+                tmp = line.decode("latin-1", "ignore")
+                line = tmp.encode("utf-8", "ignore")
+            except:
+                pass
             if len(line) == 0:
                 self.__setRun(False)
                 if self.__onPluginStoppedCallback != None:

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/i18n/I18n.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/i18n/I18n.py  
    2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/i18n/I18n.py  
    2009-09-28 07:26:54 UTC (rev 5506)
@@ -100,14 +100,6 @@
         value = value.replace("'", "''")
         for i, argument in enumerate(arguments):
             trArg = str(argument)
-            try:
-                # Some applications sends a mixed encoding. For example :
-                # Weather gadget (in french) sends message in utf-8 with
-                # arguments in latin-1 ...
-                trArg = trArg.decode("latin-1", "ignore")
-                trArg = trArg.encode("utf-8", "ignore")
-            except:
-                pass
             if self.__data.has_key(trArg):
                 trArg = self.__data[trArg]
             value = value.replace("{%d}" % i, trArg)

Modified: 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/system/Device.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/system/Device.py
  2009-09-27 23:37:12 UTC (rev 5505)
+++ 
software_suite_v3/smart-core/smart-server/branches/user_mode/util/system/Device.py
  2009-09-28 07:26:54 UTC (rev 5506)
@@ -20,21 +20,12 @@
         @param deviceKeyword: Device keyword.
         @return: A tuple (device index, device name)
         """
-        from ctypes import windll
-        winmm = windll.winmm
-        wvcps = ' ' * 52
-        cardsCount = winmm.waveOutGetNumDevs()
-        firstDevice = ""
-        for i in range(cardsCount):
-            try:
-                if winmm.waveOutGetDevCapsA(i, wvcps,len(wvcps)) == 0:
-                    deviceName = wvcps[8:].split("\0")[0]
-                    if i == 0:
-                        firstDevice = deviceName
-                    if wvcps.lower().find(deviceKeyword.lower()) != -1:
-                        return i, deviceName
-            except:
-                pass
+        import win32com.directsound.directsound as ds
+        devices = ds.DirectSoundEnumerate()
+        for i, device in enumerate(devices):
+            deviceName = device[1]
+            if deviceName.lower().find(deviceKeyword.lower()) != -1:
+                return i, deviceName
         return -1, None
 
     # 
--------------------------------------------------------------------------
@@ -99,7 +90,6 @@
             if idx == -1:
                 return "dsound:device=1"
             else:
-                idx += 1
                 return "dsound:device=%d" % idx
         else:
             return "alsa:device=plughw=TuxDroid,0"


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to