[X2Go-Commits] [pyhoca-gui] 02/03: profilemanager: With PyWxGTK 4.0, use SetItem and InsertItem rather than deprecated SetStringItem and InsertStringItem.

git-admin at x2go.org git-admin at x2go.org
Wed Dec 11 10:55:26 CET 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository pyhoca-gui.

commit a4e57ccec28e3f1c4889ce7de2acd0bf979379fe
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Dec 11 08:46:15 2019 +0100

    profilemanager: With PyWxGTK 4.0, use SetItem and InsertItem rather than deprecated SetStringItem and InsertStringItem.
---
 debian/changelog               |  2 ++
 pyhoca/wxgui/profilemanager.py | 24 ++++++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index fd24dca..82eeb1b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ pyhoca-gui (0.6.0.0-0x2go1) UNRELEASED; urgency=medium
     - Port to wxPython 4.0.x.
     - __future__ imports need to be at the very top of a .py file.
     - Add version check with gi.require_version for Notify GIR.
+    - profilemanager: With PyWxGTK 4.0, use SetItem and InsertItem rather than
+      deprecated SetStringItem and InsertStringItem.
   * debian/control:
     + Switch from Py2 to Py3 (B-Ds and Ds).
     + Bump DH compat level to version 9.
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 2155421..31ac9b8 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -20,6 +20,8 @@
 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
 import wx
+wx_major = int(wx.__version__.split('.')[0])
+
 import os
 import copy
 import types
@@ -455,9 +457,11 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         # handle check/uncheck events on SharedFoldersList items
         def _SharedFoldersList_OnCheckItem(index, flag):
             if flag:
-                self.SharedFoldersList.SetStringItem(index, 1, _("automatically"))
+                if wx_major < 4: self.SharedFoldersList.SetStringItem(index, 1, _("automatically"))
+                else:            self.SharedFoldersList.SetItem(index, 1, _("automatically"))
             else:
-                self.SharedFoldersList.SetStringItem(index, 1, _("manually"))
+                if wx_major < 4: self.SharedFoldersList.SetStringItem(index, 1, _("manually"))
+                else:            self.SharedFoldersList.SetItem(index, 1, _("manually"))
         self.SharedFoldersList.OnCheckItem = _SharedFoldersList_OnCheckItem
 
     def __set_properties(self):
@@ -1220,8 +1224,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
 
             if self.SharedFoldersList.FindItem(0, _shared_folder_path) == -1:
 
-                idx = self.SharedFoldersList.InsertStringItem(0, _shared_folder_path)
-                self.SharedFoldersList.SetStringItem(idx, 1, _shared_folder_autoconnect)
+                if wx_major < 4:
+                    idx = self.SharedFoldersList.InsertStringItem(0, _shared_folder_path)
+                    self.SharedFoldersList.SetStringItem(idx, 1, _shared_folder_autoconnect)
+                else:
+                    idx = self.SharedFoldersList.InsertItem(0, _shared_folder_path)
+                    self.SharedFoldersList.SetItem(idx, 1, _shared_folder_autoconnect)
                 if self.profile_config['export'][_shared_folder_path]:
                     self.SharedFoldersList.CheckItem(idx)
 
@@ -2415,8 +2423,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         """
         _shared_folder_path = self.SharedFolderPath.GetValue()
         if _shared_folder_path and (self.SharedFoldersList.FindItem(0, _shared_folder_path) == -1):
-            idx = self.SharedFoldersList.InsertStringItem(0, _shared_folder_path)
-            self.SharedFoldersList.SetStringItem(idx, 1, _("automatically"))
+            if wx_major < 4:
+                idx = self.SharedFoldersList.InsertStringItem(0, _shared_folder_path)
+                self.SharedFoldersList.SetStringItem(idx, 1, _("automatically"))
+            else:
+                idx = self.SharedFoldersList.InsertItem(0, _shared_folder_path)
+                self.SharedFoldersList.SetItem(idx, 1, _("automatically"))
             self.SharedFoldersList.CheckItem(idx)
             self.SharedFolderPath.SetValue('')
         self.AddSharedFolderPathButton.Enable(False)

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git


More information about the x2go-commits mailing list