comparison orpg/orpg_windows.py @ 227:81d0bfd5e800 alpha

Traipse Alpha 'OpenRPG' {100612-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 (Preparing to close updates) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to metaservers.xml file not being created
author sirebral
date Sat, 12 Jun 2010 03:50:37 -0500
parents 06f10429eedc
children
comparison
equal deleted inserted replaced
182:4b2884f29a72 227:81d0bfd5e800
19 # 19 #
20 # File: orpg_windows.py 20 # File: orpg_windows.py
21 # Author: Chris Davis 21 # Author: Chris Davis
22 # Maintainer: 22 # Maintainer:
23 # Version: 23 # Version:
24 # $Id: orpg_windows.py,v 1.42 2007/12/07 20:59:16 digitalxero Exp $ 24 # $Id: orpg_windows.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
25 # 25 #
26 # Description: orpg custom windows 26 # Description: orpg custom windows
27 # 27 #
28 28
29 __version__ = "$Id: orpg_windows.py,v 1.42 2007/12/07 20:59:16 digitalxero Exp $" 29 __version__ = "$Id: orpg_windows.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
30 30
31 from orpg.orpg_wx import * 31 from orpg.orpg_wx import *
32 from orpg.orpgCore import * 32 from orpg.orpgCore import *
33 import orpg.tools.rgbhex 33 import orpg.tools.rgbhex
34 from orpg.dirpath import dir_struct 34 from orpg.dirpath import dir_struct
54 54
55 def get_type(self,file_name): 55 def get_type(self,file_name):
56 pos = string.rfind(file_name,'.') 56 pos = string.rfind(file_name,'.')
57 ext = string.lower(file_name[pos+1:]) 57 ext = string.lower(file_name[pos+1:])
58 img_type = 0 58 img_type = 0
59 recycle_bin = {"gif": wx.BITMAP_TYPE_GIF, "jpg": wx.BITMAP_TYPE_JPEG, 59 recycle_bin = {"gif": wx.BITMAP_TYPE_GIF, "jpg": wx.BITMAP_TYPE_JPEG,
60 "jpeg": wx.BITMAP_TYPE_JPEG, "bmp": wx.BITMAP_TYPE_BMP, "png": wx.BITMAP_TYPE_PNG} 60 "jpeg": wx.BITMAP_TYPE_JPEG, "bmp": wx.BITMAP_TYPE_BMP, "png": wx.BITMAP_TYPE_PNG}
61 if recycle_bin.has_key(ext): img_type = recycle_bin[ext] 61 if recycle_bin.has_key(ext): img_type = recycle_bin[ext]
62 else: img_type = None 62 else: img_type = None
63 del recycle_bin; return img_type 63 del recycle_bin; return img_type
64 64
65 ################################ 65 ################################
66 ## Tabs 66 ## Tabs
67 ################################ 67 ################################
68 class orpgTabberWnd(FNB.FlatNotebook): 68 class orpgTabberWnd(FNB.FlatNotebook):
69 def __init__(self, parent, closeable=False, size=wx.DefaultSize, style = False): 69 def __init__(self, parent, closeable=False, size=wx.DefaultSize, style=False):
70 nbstyle = FNB.FNB_HIDE_ON_SINGLE_TAB|FNB.FNB_BACKGROUND_GRADIENT 70 nbstyle = FNB.FNB_HIDE_ON_SINGLE_TAB|FNB.FNB_BACKGROUND_GRADIENT
71 if style: nbstyle |= style
71 FNB.FlatNotebook.__init__(self, parent, -1, size=size, style=nbstyle) 72 FNB.FlatNotebook.__init__(self, parent, -1, size=size, style=nbstyle)
72 rgbcovert = orpg.tools.rgbhex.RGBHex() 73 rgbcovert = orpg.tools.rgbhex.RGBHex()
73 self.log = component.get("log") 74 self.log = component.get("log")
74 self.log.log("Enter orpgTabberWnd", ORPG_DEBUG) 75 self.log.log("Enter orpgTabberWnd", ORPG_DEBUG)
75 self.settings = component.get("settings") 76 self.settings = component.get("settings")
76 tabtheme = self.settings.get_setting('TabTheme') 77 tabtheme = self.settings.get('TabTheme')
77 tabtext = self.settings.get_setting('TabTextColor') 78 tabtext = self.settings.get('TabTextColor')
78 (tred, tgreen, tblue) = rgbcovert.rgb_tuple(tabtext) 79 (tred, tgreen, tblue) = rgbcovert.rgb_tuple(tabtext)
79 tabbedwindows = component.get("tabbedWindows") 80 component.get("tabbedWindows").append(self)
80 tabbedwindows.append(self)
81 component.add("tabbedWindows", tabbedwindows)
82 81
83 theme_dict = {'slanted&aqua': FNB.FNB_VC8, 'slanted&bw': FNB.FNB_VC8, 'flat&aqua': FNB.FNB_FANCY_TABS, 82 theme_dict = {'slanted&aqua': FNB.FNB_VC8, 'slanted&bw': FNB.FNB_VC8, 'flat&aqua': FNB.FNB_FANCY_TABS,
84 'flat&bw': FNB.FNB_FANCY_TABS, 'customflat': FNB.FNB_FANCY_TABS, 'customslant': FNB.FNB_VC8, 83 'flat&bw': FNB.FNB_FANCY_TABS, 'customflat': FNB.FNB_FANCY_TABS, 'customslant': FNB.FNB_VC8}
85 'slanted&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS, 'slant&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS} 84 #'slanted&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS, 'slant&colorful': FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS}
86 nbstyle |= theme_dict[tabtheme] 85 if theme_dict.has_key(tabtheme): style |= theme_dict[tabtheme]
87 if style: nbstyle |= style 86 else: style |= theme_dict['customflat']; self.settings.change('TabTheme', 'customflat')
88 self.SetWindowStyleFlag(nbstyle) 87 self.SetWindowStyleFlag(style)
88
89 tabbg = self.settings.get('TabBackgroundGradient')
90 (red, green, blue) = rgbcovert.rgb_tuple(tabbg)
91 self.SetTabAreaColour(wx.Color(red, green, blue))
89 92
90 # Tas - sirebral. Planned changes to the huge statement below. 93 # Tas - sirebral. Planned changes to the huge statement below.
91 if tabtheme == 'slanted&aqua': 94 if tabtheme == 'slanted&aqua':
92 self.SetGradientColourTo(wx.Color(0, 128, 255)) 95 self.SetGradientColourTo(wx.Color(0, 128, 255))
93 self.SetGradientColourFrom(wx.WHITE) 96 self.SetGradientColourFrom(wx.WHITE)
97 self.SetNonActiveTabTextColour(wx.BLACK)
94 98
95 elif tabtheme == 'slanted&bw': 99 elif tabtheme == 'slanted&bw':
96 self.SetGradientColourTo(wx.WHITE) 100 self.SetGradientColourTo(wx.WHITE)
97 self.SetGradientColourFrom(wx.WHITE) 101 self.SetGradientColourFrom(wx.WHITE)
102 self.SetNonActiveTabTextColour(wx.BLACK)
98 103
99 elif tabtheme == 'flat&aqua': 104 elif tabtheme == 'flat&aqua':
100 self.SetGradientColourFrom(wx.Color(0, 128, 255)) 105 self.SetGradientColourTo(wx.Color(0, 128, 255))
101 self.SetGradientColourTo(wx.WHITE) 106 self.SetGradientColourFrom(wx.WHITE)
102 self.SetNonActiveTabTextColour(wx.BLACK) 107 self.SetNonActiveTabTextColour(wx.BLACK)
103 108
104 elif tabtheme == 'flat&bw': 109 elif tabtheme == 'flat&bw':
105 self.SetGradientColourTo(wx.WHITE) 110 self.SetGradientColourTo(wx.WHITE)
106 self.SetGradientColourFrom(wx.WHITE) 111 self.SetGradientColourFrom(wx.WHITE)
107 self.SetNonActiveTabTextColour(wx.BLACK) 112 self.SetNonActiveTabTextColour(wx.BLACK)
108 113
109 elif tabtheme == 'customflat': 114 elif tabtheme == 'customflat':
110 gfrom = self.settings.get_setting('TabGradientFrom') 115 (red, green, blue) = rgbcovert.rgb_tuple(self.settings.get_setting('TabGradientTo'))
111 (red, green, blue) = rgbcovert.rgb_tuple(gfrom) 116 self.SetGradientColourTo(wx.Color(red, green, blue))
117
118 (red, green, blue) = rgbcovert.rgb_tuple(self.settings.get_setting('TabGradientFrom'))
112 self.SetGradientColourFrom(wx.Color(red, green, blue)) 119 self.SetGradientColourFrom(wx.Color(red, green, blue))
113 120 self.SetNonActiveTabTextColour(wx.Color(tred, tgreen, tblue))
114 gto = self.settings.get_setting('TabGradientTo') 121
115 (red, green, blue) = rgbcovert.rgb_tuple(gto) 122 elif tabtheme == 'customslant':
123 (red, green, blue) = rgbcovert.rgb_tuple(self.settings.get_setting('TabGradientTo'))
116 self.SetGradientColourTo(wx.Color(red, green, blue)) 124 self.SetGradientColourTo(wx.Color(red, green, blue))
125
126 (red, green, blue) = rgbcovert.rgb_tuple(self.settings.get_setting('TabGradientFrom'))
127 self.SetGradientColourFrom(wx.Color(red, green, blue))
117 self.SetNonActiveTabTextColour(wx.Color(tred, tgreen, tblue)) 128 self.SetNonActiveTabTextColour(wx.Color(tred, tgreen, tblue))
118 129
119 elif tabtheme == 'customslant':
120 gfrom = self.settings.get_setting('TabGradientFrom')
121 (red, green, blue) = rgbcovert.rgb_tuple(gfrom)
122 self.SetGradientColourFrom(wx.Color(red, green, blue))
123
124 gto = self.settings.get_setting('TabGradientTo')
125 (red, green, blue) = rgbcovert.rgb_tuple(gto)
126 self.SetGradientColourTo(wx.Color(red, green, blue))
127 self.SetNonActiveTabTextColour(wx.Color(tred, tgreen, tblue))
128
129 tabbg = self.settings.get_setting('TabBackgroundGradient')
130 (red, green, blue) = rgbcovert.rgb_tuple(tabbg)
131 self.SetTabAreaColour(wx.Color(red, green, blue))
132 self.Refresh() 130 self.Refresh()
133 self.log.log("Exit orpgTabberWnd", ORPG_DEBUG) 131 self.log.log("Exit orpgTabberWnd", ORPG_DEBUG)
134 132
135 133
136 ######################## 134 ########################