changeset 196:0bc44a57ae6c alpha

Traipse Alpha 'OpenRPG' {100425-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Patch-2) New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues
author sirebral
date Sun, 25 Apr 2010 23:26:55 -0500
parents b633f4c64aae
children fcd6aafbe232
files orpg/chat/chatwnd.py orpg/gametree/gametree.py orpg/gametree/nodehandlers/chatmacro.py orpg/gametree/nodehandlers/containers.py orpg/gametree/nodehandlers/forms.py orpg/main.py orpg/mapper/background.py orpg/orpg_version.py orpg/tools/InterParse.py plugins/xxurl2link.py
diffstat 10 files changed, 115 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/chat/chatwnd.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/chat/chatwnd.py	Sun Apr 25 23:26:55 2010 -0500
@@ -1032,7 +1032,7 @@
         sound_file = self.settings.get_setting("SendSound")
         if sound_file != '': component.get('sound').play(sound_file)
         if s[0] != "/": ## it's not a slash command
-            s = self.ParsePost( s, True, True )
+            s = Parse.Post(s, self, True, True)
         else: self.chat_cmds.docmd(s) # emote is in chatutils.py
 
     def on_chat_key_down(self, event):
@@ -1171,7 +1171,7 @@
         if len(dieMod) and dieMod[0] not in "*/-+": dieMod = "+" + dieMod
         dieText += dieMod
         dieText = "[" + dieText + "]"
-        self.ParsePost(dieText, 1, 1)
+        Parse.Post(dieText, self, 1, 1)
         self.chattxt.SetFocus()
 
     def on_chat_save(self, evt):
@@ -1301,7 +1301,7 @@
         return text
 
     def emote_message(self, text):
-        text = Parse.Normalize(text)
+        text = Parse.Normalize(text, self)
         text = self.colorize(self.emotecolor, text)
         if self.type == MAIN_TAB and self.sendtarget == 'all': self.send_chat_message(text,chat_msg.EMOTE_MESSAGE)
         elif self.type == MAIN_TAB and self.sendtarget == "gm":
@@ -1319,7 +1319,7 @@
 
     def whisper_to_players(self, text, player_ids):
         tabbed_whispers_p = self.settings.get_setting("tabbedwhispers")
-        text = Parse.Normalize(text)
+        text = Parse.Normalize(text, self)
         player_names = ""
         for m in player_ids:
             id = m.strip()
@@ -1386,6 +1386,7 @@
         if (strip_img == "0"): display_name = chat_util.strip_img_tags(display_name)
         recvSound = "RecvSound"
         # act on the type of messsage
+
         if (type == chat_msg.CHAT_MESSAGE):
             text = "<b>" + display_name + "</b>: " + text
             self.Post(text)
@@ -1591,11 +1592,6 @@
             logger.general("EXCEPTION: " + str(e))
             return "[ERROR]"
 
-    def ParsePost(self, s, send=False, myself=False):
-        s = Parse.Normalize(s)
-        self.set_colors()
-        self.Post(s,send,myself)
-
     # This subroutine builds a chat display name.
     #
     def chat_display_name(self, player):
--- a/orpg/gametree/gametree.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/gametree/gametree.py	Sun Apr 25 23:26:55 2010 -0500
@@ -804,7 +804,7 @@
         self.rename_flag = 0
         if txt != "":
             obj = self.GetPyData(item)
-            obj.xml_root.setAttribute('name',txt)
+            obj.xml_root.set('name',txt)
         else: evt.Veto()
     
     def on_label_begin(self, evt):
--- a/orpg/gametree/nodehandlers/chatmacro.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/gametree/nodehandlers/chatmacro.py	Sun Apr 25 23:26:55 2010 -0500
@@ -98,6 +98,6 @@
         txt = self.text[id].GetValue()
         if txt == "": return
         if id == P_TITLE:
-            self.handler.xml.setAttribute('name',txt)
+            self.handler.xml.set('name',txt)
             self.handler.rename(txt)
         elif id == P_BODY: self.handler.set_text(txt)
--- a/orpg/gametree/nodehandlers/containers.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/gametree/nodehandlers/containers.py	Sun Apr 25 23:26:55 2010 -0500
@@ -245,7 +245,6 @@
         parent.SetSize(self.GetBestSize())
         self.Bind(wx.EVT_TEXT, self.on_text, id=1)
 
-
     def on_text(self,evt):
         txt = self.title.GetValue()
         if txt != "":
@@ -281,18 +280,19 @@
         container_handler.on_drop(self,evt)
 
     def build_splitter_wnd(self, parent, mode):
+        self.parent = parent
         self.split = self.xml.get("horizontal")
         self.pane = splitter_panel(parent, self, mode)
+        self.frame = self.pane.frame
         self.splitter = MultiSplitterWindow(self.pane, -1, 
                         style=wx.SP_LIVE_UPDATE|wx.SP_3DSASH|wx.SP_NO_XP_THEME)
+        self.splitter.parent = self
         if self.split == '1': self.splitter.SetOrientation(wx.VERTICAL)
         else: self.splitter.SetOrientation(wx.HORIZONTAL)
-        self.bestSizex = -1
-        self.bestSizey = -1
         self.tree.traverse(self.mytree_node, self.doSplit, mode, False) 
-        self.pane.sizer.Add(self.splitter, 1, wx.EXPAND)
-        self.pane.SetSize((self.bestSizex, self.bestSizey))
-        self.pane.Layout()
+        self.pane.sizer.Add(self.splitter, -1, wx.EXPAND)
+        self.pane.SetAutoLayout(True)
+        self.pane.Fit()
         parent.SetSize(self.pane.GetSize())
         return self.pane
 
@@ -300,26 +300,24 @@
         node = self.tree.GetPyData(treenode)
         if mode == 1: tmp = node.get_design_panel(self.splitter)
         else: tmp = node.get_use_panel(self.splitter)
-        if self.split == '1':
-            sash = tmp.GetBestSize()[1]+1
-            self.bestSizey += sash+11
-            if self.bestSizex < tmp.GetBestSize()[0]: self.bestSizex = tmp.GetBestSize()[0]+10
-        else:
-            sash = tmp.GetBestSize()[0]+1
-            self.bestSizex += sash
-            if self.bestSizey < tmp.GetBestSize()[1]: self.bestSizey = tmp.GetBestSize()[1]+31
+        if self.split == '1': sash = self.frame.GetSize()[1]/len(self.xml.findall('nodehandler'))
+        else: sash = self.frame.GetSize()[0]/len(self.xml.findall('nodehandler'))
         self.splitter.AppendWindow(tmp, sash)
+
     def get_size_constraint(self):
         return 1
 
 class splitter_panel(wx.Panel):
     def __init__(self, parent, handler, mode):
         wx.Panel.__init__(self, parent, -1)
+        self.parent = parent
         self.handler = handler
         self.sizer = wx.BoxSizer(wx.VERTICAL)
         if mode == 0: self.title = wx.StaticText(self, 1, handler.xml.get('name'))
         elif mode == 1: self.title = wx.TextCtrl(self, 1, handler.xml.get('name'))
-        #self.title = wx.TextCtrl(self, 1, handler.xml.get('name'))
+        self.frame = self.GetParent()
+        while self.frame.GetName() != 'frame':
+            self.frame = self.frame.GetParent()
 
         if mode == 1:
             self.hozCheck = wx.CheckBox(self, -1, "Horizontal Split")
--- a/orpg/gametree/nodehandlers/forms.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/gametree/nodehandlers/forms.py	Sun Apr 25 23:26:55 2010 -0500
@@ -109,11 +109,11 @@
 
 F_HEIGHT = wx.NewId()
 F_WIDTH = wx.NewId()
-class form_edit_panel(wx.Panel):
+class form_edit_panel(ScrolledPanel):
     def __init__(self, parent, handler):
-        wx.Panel.__init__(self, parent, -1)
+        ScrolledPanel.__init__(self, parent, wx.ID_ANY, style=wx.NO_BORDER|wx.VSCROLL|wx.HSCROLL)
         self.handler = handler
-        sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Form Properties"), wx.VERTICAL)
+        self.main_sizer = wx.BoxSizer(wx.VERTICAL)
         wh_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.text = {   P_TITLE : wx.TextCtrl(self, P_TITLE, handler.xml.get('name')),
                         F_HEIGHT : wx.TextCtrl(self, F_HEIGHT, handler.xml.get('height')),
@@ -128,15 +128,17 @@
         wh_sizer.Add(wx.Size(10,10))
         wh_sizer.Add(self.text[F_HEIGHT], 0, wx.EXPAND)
 
-        sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
-        sizer.Add(self.text[P_TITLE], 0, wx.EXPAND)
-        sizer.Add(wx.Size(10,10))
-        sizer.Add(wh_sizer,0,wx.EXPAND)
+        self.main_sizer.Add(wx.StaticText(self, -1, "Title:"), 0, wx.EXPAND)
+        self.main_sizer.Add(self.text[P_TITLE], 0, wx.EXPAND)
+        self.main_sizer.Add(wx.Size(10,10))
+        self.main_sizer.Add(wh_sizer,0,wx.EXPAND)
+        handler.tree.traverse(handler.mytree_node, self.create_child_wnd, None, False)
 
-        self.SetSizer(sizer)
+        self.SetSizer(self.main_sizer)
         self.SetAutoLayout(True)
+        self.SetupScrolling()
+        parent.SetSize(self.GetSize())
         self.Fit()
-        parent.SetSize(self.GetBestSize())
 
         self.Bind(wx.EVT_TEXT, self.on_text, id=P_TITLE)
         self.Bind(wx.EVT_TEXT, self.on_text, id=F_HEIGHT)
@@ -155,6 +157,14 @@
             if id == F_HEIGHT: self.handler.xml.set("height",txt)
             elif id == F_WIDTH: self.handler.xml.set("width",txt)
 
+    def create_child_wnd(self, treenode, evt):
+        node = self.handler.tree.GetPyData(treenode)
+        panel = node.get_design_panel(self)
+        size = node.get_size_constraint()
+        if panel:
+            self.main_sizer.Add(panel, size, wx.EXPAND)
+            self.main_sizer.Add(wx.Size(10,10))
+
 ##########################
 ## control handler
 ##########################
@@ -320,7 +330,7 @@
             sizer_style=wx.EXPAND
             text_style = 0
             multi = 0
-        self.text = wx.TextCtrl(self, F_TEXT, handler.get_value(),style=text_style)
+        self.text = wx.TextCtrl(self, F_TEXT, handler.get_value() or '',style=text_style)
         sizer.Add(wx.Size(5,0))
         sizer.Add(self.text, multi, sizer_style)
         self.SetSizer(sizer)
@@ -619,6 +629,7 @@
 class listbox_panel(wx.Panel):
     def __init__(self, parent, handler):
         wx.Panel.__init__(self, parent, -1)
+        #ScrolledPanel.__init__(self, parent, wx.ID_ANY, style=wx.NO_BORDER|wx.VSCROLL|wx.HSCROLL)
         self.handler = handler
         self.chat = handler.chat
         opts = []
@@ -636,8 +647,8 @@
             if self.list.GetSize()[0] > 200:
                 self.list.Destroy()
                 self.list = wx.ComboBox(self, F_LIST, cur_opt, size=(200, -1), choices=opts, style=wx.CB_READONLY)
-        elif type == L_LIST: self.list = wx.ListBox(self,F_LIST,choices=opts)
-        elif type == L_RADIO: self.list = wx.RadioBox(self,F_LIST,label,choices=opts,majorDimension=3)
+        elif type == L_LIST: self.list = wx.ListBox(self, F_LIST, choices=opts)
+        elif type == L_RADIO: self.list = wx.RadioBox(self, F_LIST, label, choices=opts, majorDimension=3)
         elif type == L_CHECK:
             self.list = wx.CheckListBox(self,F_LIST,choices=opts)
             self.set_checks()
@@ -649,17 +660,17 @@
         else: sizer = wx.BoxSizer(wx.VERTICAL)
 
         if type != L_RADIO:
-            sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND)
-            sizer.Add(wx.Size(5,0))
-        sizer.Add(self.list, 1, wx.EXPAND)
+            sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND|wx.ALL)
+        sizer.Add(self.list, 1, wx.EXPAND|wx.ALL)
         if handler.has_send_button():
-            sizer.Add(wx.Button(self, F_SEND, "Send"), 0, wx.EXPAND)
+            sizer.Add(wx.Button(self, F_SEND, "Send"), 0, wx.EXPAND|wx.ALL)
             self.Bind(wx.EVT_BUTTON, self.handler.on_send_to_chat, id=F_SEND)
         self.sizer = sizer
         self.SetSizer(sizer)
         self.SetAutoLayout(True)
+        #self.SetupScrolling()
+        #parent.SetSize(self.GetBestSize())
         self.Fit()
-        parent.SetSize(self.GetBestSize())
 
         if type == L_DROP: self.Bind(wx.EVT_COMBOBOX, self.on_change, id=F_LIST)
         elif type == L_LIST: self.Bind(wx.EVT_LISTBOX, self.on_change, id=F_LIST)
--- a/orpg/main.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/main.py	Sun Apr 25 23:26:55 2010 -0500
@@ -790,7 +790,7 @@
             temp_wnd = orpg.chat.chatwnd.chat_notebook(parent_wnd, wx.DefaultSize)
             self.chattabs = temp_wnd
             self.chat = temp_wnd.MainChatPanel
-            component.add("chat",self.chat)
+            component.add("chat", self.chat)
 
         elif name == "player":
             temp_wnd = orpg.player_list.player_list(parent_wnd)
--- a/orpg/mapper/background.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/mapper/background.py	Sun Apr 25 23:26:55 2010 -0500
@@ -34,6 +34,7 @@
 from orpg.orpgCore import component
 from orpg.tools.orpg_log import logger
 from orpg.tools.orpg_settings import settings
+from xml.etree.ElementTree import fromstring
 
 ##-----------------------------
 ## background layer
@@ -244,22 +245,21 @@
     def upload(self, postdata, filename, type):
         self.lock.acquire()
         if type == 'Image' or type == 'Texture':
-            url = component.get('settings').get_setting('ImageServerBaseURL')
+            url = settings.get_setting('ImageServerBaseURL')
             file = urllib.urlopen(url, postdata)
             recvdata = file.read()
             file.close()
             try:
-                xml_dom = minidom.parseString(recvdata)._get_documentElement()
-                if xml_dom.nodeName == 'path':
-                    path = xml_dom.getAttribute('url')
+                xml_dom = fromstring(recvdata)
+                if xml_dom.tag == 'path':
+                    path = xml_dom.get('url')
                     path = urllib.unquote(path)
                     if type == 'Image': self.set_image(path, 1)
                     else: self.set_texture(path)
                     self.localPath = filename
                     self.local = True
                     self.localTime = time.time()
-                else:
-                    print xml_dom.getAttribute('msg')
+                else: print xml_dom.get('msg')
             except Exception, e:
                 print e
                 print recvdata
--- a/orpg/orpg_version.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/orpg_version.py	Sun Apr 25 23:26:55 2010 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Alpha"
 DIS_VER = "Ornery Orc"
-BUILD = "100424-00"
+BUILD = "100425-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/orpg/tools/InterParse.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/orpg/tools/InterParse.py	Sun Apr 25 23:26:55 2010 -0500
@@ -31,16 +31,18 @@
 import re
 from orpg.tools.orpg_log import logger
 from wx import TextEntryDialog, ID_OK
+from xml.etree.ElementTree import iselement
 
 class InterParse():
 
     def __init__(self):
         pass
 
-    def Post(self, s, send=False, myself=False):
-        s = self.Normalize(s)
-        component.get('chat').set_colors()
-        component.get('chat').Post(s, send, myself)
+    def Post(self, s, tab=True, send=False, myself=False):
+        if tab: tab = component.get('chat')
+        s = self.Normalize(s, tab)
+        tab.set_colors()
+        tab.Post(s, send, myself)
 
     def ParseLogic(self, s, node):
         'Nodes now parse through ParsLogic. Easily add new parse rules right here!!'
@@ -50,24 +52,24 @@
         s = self.NodeParent(s, node.get('map'))
         return s
 
-    def Normalize(self, s):
-        for plugin_fname in component.get('chat').activeplugins.keys():
-            plugin = component.get('chat').activeplugins[plugin_fname]
+    def Normalize(self, s, tab):
+        for plugin_fname in tab.activeplugins.keys():
+            plugin = tab.activeplugins[plugin_fname]
             try: s = plugin.pre_parse(s)
             except Exception, e:
                 if str(e) != "'module' object has no attribute 'post_msg'":
                     logger.general(traceback.format_exc())
                     logger.general("EXCEPTION: " + str(e))
-        if component.get('chat').parsed == 0:
+        if tab.parsed == 0:
             s = self.NameSpaceE(s)
             s = self.Node(s)
             s = self.Dice(s)
-            s = self.Filter(s)
-            component.get('chat').parsed = 1
+            s = self.Filter(s, tab)
+            tab.parsed = 1
         return s
     
-    def Filter(self, s):
-        s = component.get('chat').GetFilteredText(s)
+    def Filter(self, s, tab):
+        s = tab.GetFilteredText(s)
         return s
 
     def Node(self, s):
@@ -128,45 +130,59 @@
     def NameSpaceI(self, s, node):
         reg = re.compile("(!=(.*?)=!)")
         matches = reg.findall(s)
+        newstr = False
         for i in xrange(0,len(matches)):
             tree_map = node.get('map').split('::')
-            root = self.get_node(tree_map[0])
+            roots = []; root_list = []
             find = matches[i][1].split('::')
-            names = root.getiterator('nodehandler')
-            for name in names:
-                if find[0] == name.get('name'):
-                    if name.get('class') == 'rpg_grid_handler': 
-                        newstr = self.NameSpaceGrid(find, name); break
-                    else: newstr = str(name.find('text').text); break
-                else: newstr = 'Invalid Reference!'
+            for x in xrange(0, len(tree_map)):
+                roots.append(tree_map[x])
+                root_list.append(self.get_node(roots))
+                namespace = root_list[x].getiterator('nodehandler')
+                for node in namespace:
+                    if find[0] == node.get('name'):
+                        if node.get('class') == 'rpg_grid_handler': 
+                            newstr = self.NameSpaceGrid(find[1], node); break
+                        else: 
+                            newstr = str(node.find('text').text); break
+            if not newstr: newstr = 'Invalid Reference!'; break
             s = s.replace(matches[i][0], newstr, 1)
-            s = self.ParseLogic(s, name)
+            s = self.ParseLogic(s, node)
         return s
 
     def NameSpaceE(self, s):
         reg = re.compile("(!&(.*?)&!)")
         matches = reg.findall(s)
+        newstr = 'False'; x = 0
         for i in xrange(0,len(matches)):
             find = matches[i][1].split('::')
-            root = find[0]
-            root = self.get_node(root)
-            names = root.getiterator('nodehandler')
-            for name in names:
-                if find[1] == name.get('name'):
-                    if name.get('class') == 'rpg_grid_handler': 
-                        newstr = self.NameSpaceGrid([find[1], find[2]], name); break
-                    else: newstr = str(name.find('text').text); break
-                else: newstr = 'Invalid Reference!'
+            node = self.get_node([find[0]])
+            last = find[len(find)-1]
+            if not iselement(node): 
+                s = s.replace(matches[i][0], 'Invalid Reference!', 1); 
+                s = self.NameSpaceE(s)
+                return s
+            while newstr == 'False':
+                namespace = node.getiterator('nodehandler'); x += 1
+                for node in namespace:
+                    if find[x] == node.get('name'):
+                        if node.get('class') == 'map_miniature_handler': continue
+                        elif node.get('class') == 'rpg_grid_handler': 
+                            newstr = self.NameSpaceGrid(last, node); break
+                        elif x == len(find)-1: newstr = str(node.find('text').text); break
+                        else: break
+                else: newstr = 'Invalid Reference!'; break
             s = s.replace(matches[i][0], newstr, 1)
-            s = self.ParseLogic(s, name)
+            s = self.ParseLogic(s, node)
         return s
 
     def NameSpaceGrid(self, s, node):
-        cell = tuple(s[1].strip('(').strip(')').split(','))
+        cell = tuple(s.strip('(').strip(')').split(','))
         grid = node.find('grid')
         rows = grid.findall('row')
-        col = rows[int(self.Dice(cell[0]))-1].findall('cell')
-        try: s = self.ParseLogic(col[int(self.Dice(cell[1]))-1].text, node) or 'No Cell Data'
+        try:
+            col = rows[int(self.Dice(cell[0]))-1].findall('cell')
+            s = self.ParseLogic(col[int(self.Dice(cell[1]))-1].text, node) or 'No Cell Data'
         except: s = 'Invalid Grid Reference!'
         return s
 
@@ -195,7 +211,7 @@
             del new_map[len(new_map)-1]
             parent_map = matches[i][1].split('::')
             ## Backwards Reference the Parent Children
-            child_node = self.get_node('::'.join(new_map))
+            child_node = self.get_node(new_map)
             newstr = self.get_root(child_node, tree_map, new_map, parent_map)
             s = s.replace(matches[i][0], newstr, 1)
             s = self.Node(s)
@@ -213,14 +229,13 @@
         if newstr != '': return newstr
         else:
             del new_map[len(new_map)-1]
-            child_node = self.get_node('::'.join(new_map))
+            child_node = self.get_node(new_map)
             newstr = self.get_root(child_node, tree_map, new_map, parent_map)
             return newstr
 
-    def get_node(self, s):
+    def get_node(self, path):
         return_node = 'Invalid Reference!'
         value = ""
-        path = s.split('::')
         depth = len(path)
         try: node = component.get('tree').tree_map[path[0]]['node']
         except Exception, e: return return_node
@@ -230,7 +245,7 @@
     def resolve_get_loop(self, node, path, step, depth):
         if step == depth: return node
         else:
-            child_list = node.findall('nodehandler')
+            child_list = node.getiterator('nodehandler')
             for child in child_list:
                 if step == depth: break
                 if child.get('name') == path[step]:
--- a/plugins/xxurl2link.py	Sat Apr 24 08:37:20 2010 -0500
+++ b/plugins/xxurl2link.py	Sun Apr 25 23:26:55 2010 -0500
@@ -22,9 +22,10 @@
         self.menu = wx.Menu()
         self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'On')
         self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle)
-        self.toggle.Check(True)
 
     def plugin_toggle(self, evt):
+        if self.toggle.IsChecked() == True: self.plugindb.SetString('xxurl2link', 'url2link', 'True')
+        if self.toggle.IsChecked() == False: self.plugindb.SetString('xxurl2link', 'url2link', 'False')
         pass
 
     def plugin_enabled(self):
@@ -33,6 +34,9 @@
 
         self.mailto_regex = re.compile("(?<![=\"a-z0-9:/.])((?:[a-z0-9]+[_]?[a-z0-9]*)+@{1}(?:[a-z0-9]+[-.]?[a-z0-9]+)*\.(?:[a-z]{2,4}))", re.I)
 
+        self.link = self.plugindb.GetString('xxurl2link', 'url2link', '') or 'False'
+        self.toggle.Check(True) if self.link == 'True' else self.toggle.Check(False)
+
     def plugin_disabled(self):
         #Here you need to remove any commands you added, and anything else you want to happen when you disable the plugin
         #such as closing windows created by the plugin