equal
deleted
inserted
replaced
21 # You should have received a copy of the GNU General Public License |
21 # You should have received a copy of the GNU General Public License |
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 |
25 |
26 |
26 import pickle |
27 from six.moves import cPickle |
|
28 import wx |
27 import wx |
29 |
28 |
30 MAX_ITEM_COUNT = 10 |
29 MAX_ITEM_COUNT = 10 |
31 MAX_ITEM_SHOWN = 6 |
30 MAX_ITEM_SHOWN = 6 |
32 if wx.Platform == '__WXMSW__': |
31 if wx.Platform == '__WXMSW__': |
196 event.Skip() |
195 event.Skip() |
197 |
196 |
198 def OnControlChanged(self, event): |
197 def OnControlChanged(self, event): |
199 res = self.GetValue() |
198 res = self.GetValue() |
200 config = wx.ConfigBase.Get() |
199 config = wx.ConfigBase.Get() |
201 listentries = cPickle.loads(str(config.Read(self.element_path, cPickle.dumps([])))) |
200 listentries = pickle.loads(config.Read(self.element_path, |
|
201 pickle.dumps([], 0).decode() |
|
202 ).encode()) |
202 if res and res not in listentries: |
203 if res and res not in listentries: |
203 listentries = (listentries + [res])[-MAX_ITEM_COUNT:] |
204 listentries = (listentries + [res])[-MAX_ITEM_COUNT:] |
204 config.Write(self.element_path, cPickle.dumps(listentries)) |
205 config.Write(self.element_path, pickle.dumps(listentries, 0)) |
205 config.Flush() |
206 config.Flush() |
206 self.SetChoices(listentries) |
207 self.SetChoices(listentries) |
207 self.DismissListBox() |
208 self.DismissListBox() |
208 self._hasfocus = False |
209 self._hasfocus = False |
209 event.Skip() |
210 event.Skip() |