comparison orpg/chat/chatwnd.py @ 87:eb1b275699c4 alpha

Traipse Alpha 'OpenRPG' {090917-01} 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: 00: Adds menu changes to draw attention to important updates, errors, or other events. (image info coming soon) Traipse URL is not included in the repos tab and is set as default. 01: Fixes Copy for Windows and Linux (finally!!) users. Fixes incomplete update to Grid and List nodes. Fixes incomplete update to Chat Commands.
author sirebral
date Thu, 17 Sep 2009 03:23:03 -0500
parents 2fa8bd6785a5
children 65c1604e7949 7ed4979cc1cf
comparison
equal deleted inserted replaced
86:bdbeafcb2ef4 87:eb1b275699c4
71 from orpg.tools.validate import validate 71 from orpg.tools.validate import validate
72 from orpg.tools.orpg_settings import settings 72 from orpg.tools.orpg_settings import settings
73 from orpg.orpgCore import component 73 from orpg.orpgCore import component
74 from orpg.tools.orpg_log import logger 74 from orpg.tools.orpg_log import logger
75 from orpg.tools.decorators import debugging 75 from orpg.tools.decorators import debugging
76
76 NEWCHAT = False 77 NEWCHAT = False
77 try: 78 try:
78 import wx.webview 79 import wx.webview
79 NEWCHAT = True 80 NEWCHAT = True
80 except: pass 81 except: pass
174 self.Bind(wx.EVT_MENU, self.OnM_EditCopy, item) 175 self.Bind(wx.EVT_MENU, self.OnM_EditCopy, item)
175 self.menu.AppendItem(item) 176 self.menu.AppendItem(item)
176 177
177 @debugging 178 @debugging
178 def OnM_EditCopy(self, evt): 179 def OnM_EditCopy(self, evt):
180 wx.TheClipboard.UsePrimarySelection(False)
179 wx.TheClipboard.Open() 181 wx.TheClipboard.Open()
180 wx.TheClipboard.Clear()
181 wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText())) 182 wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText()))
182 wx.TheClipboard.Close() 183 wx.TheClipboard.Close()
183 184
184 @debugging 185 @debugging
185 def scroll_down(self): 186 def scroll_down(self):
288 event.Skip() 289 event.Skip()
289 wx.CallAfter(self.parent.set_chat_text_focus, None) 290 wx.CallAfter(self.parent.set_chat_text_focus, None)
290 291
291 @debugging 292 @debugging
292 def OnM_EditCopy(self, evt): 293 def OnM_EditCopy(self, evt):
293 self.Copy() 294 wx.TheClipboard.UsePrimarySelection(False)
295 wx.TheClipboard.Open()
296 wx.TheClipboard.SetData(wx.TextDataObject(self.SelectionToText()))
297 wx.TheClipboard.Close()
294 298
295 #Cutom Methods 299 #Cutom Methods
296 @debugging 300 @debugging
297 def Header(self): 301 def Header(self):
298 return "<html><head><style>body {font-size: " + str(self.GetFont().GetPointSize()) + "px;font-family: " + self.GetFont().GetFaceName() + ";color: " + self.parent.textcolor + ";background-color: " + self.parent.bgcolor + ";margin: 0;padding: 0 0;height: 100%;}</style></head><body>" 302 return "<html><head><style>body {font-size: " + str(self.GetFont().GetPointSize()) + "px;font-family: " + self.GetFont().GetFaceName() + ";color: " + self.parent.textcolor + ";background-color: " + self.parent.bgcolor + ";margin: 0;padding: 0 0;height: 100%;}</style></head><body>"
872 self.dieIDs[self.d100Button.GetId()] = 'd100' 876 self.dieIDs[self.d100Button.GetId()] = 'd100'
873 self.Bind(wx.EVT_BUTTON, self.pop_textpop, self.textpop_lock) 877 self.Bind(wx.EVT_BUTTON, self.pop_textpop, self.textpop_lock)
874 self.Bind(wx.EVT_BUTTON, self.lock_scroll, self.scroll_lock) 878 self.Bind(wx.EVT_BUTTON, self.lock_scroll, self.scroll_lock)
875 self.chattxt.Bind(wx.EVT_MOUSEWHEEL, self.chatwnd.mouse_wheel) 879 self.chattxt.Bind(wx.EVT_MOUSEWHEEL, self.chatwnd.mouse_wheel)
876 self.chattxt.Bind(wx.EVT_CHAR, self.chattxt.OnChar) 880 self.chattxt.Bind(wx.EVT_CHAR, self.chattxt.OnChar)
877 self.chattxt.Bind(wx.EVT_TEXT_COPY, self.textCopy) 881 self.chattxt.Bind(wx.EVT_TEXT_COPY, self.chatwnd.OnM_EditCopy)
878 # def build_ctrls - end 882 # def build_ctrls - end
879
880 @debugging
881 def textCopy(self, event):
882 if self.chattxt.GetStringSelection() == '': self.chatwnd.OnM_EditCopy(None)
883 else: self.chatwnd.Copy()
884 883
885 @debugging 884 @debugging
886 def build_bar(self): 885 def build_bar(self):
887 self.toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL) 886 self.toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)
888 self.scroll_lock = None 887 self.scroll_lock = None