00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 from objects.logic.common.exception import exception
00017 from objects.logic.common.logger import logger
00018 from objects.logic.configuration.configurator import configurator
00019 from objects.logic.common.globalStrings import globalStrings
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class displayConfigurator(configurator):
00032
00033
00034
00035
00036
00037
00038
00039
00040 def glb_getMinXferOptions(self):
00041 mdxh = self.getConfigValue("Global", "min_data_xfer_hide", True, True)
00042 mdx = self.getConfigValue("Global", "min_data_xfer", "1000", True)
00043 mdxs = self.getConfigValue("Global", "min_data_xfer_scale", "10", True)
00044
00045 if mdxh == "True":
00046 mdxh = True
00047 else:
00048 mdxh = False
00049
00050
00051 return (mdxh, int(mdx), int(mdxs))
00052
00053
00054
00055
00056
00057
00058
00059 def glb_getMaxIdleOptions(self):
00060 mith = self.getConfigValue("Global", "max_idle_time_hide", True, True)
00061 mit = self.getConfigValue("Global", "max_idle_time", "30", True)
00062 mits = self.getConfigValue("Global", "max_idle_time_scale", "60", True)
00063
00064 if mith == "True":
00065 mith = True
00066 else:
00067 mith = False
00068
00069
00070 return (mith, int(mit), int(mits))
00071
00072
00073
00074
00075 def glb_getFadeTime(self):
00076 mit = self.getConfigValue("Global", "max_idle_time", "30", True)
00077 mits = self.getConfigValue("Global", "max_idle_time_scale", "60", True)
00078
00079 return int(mit) * int(mits)
00080
00081
00082
00083
00084
00085 def glb_getLineOptions(self):
00086 lins = self.getConfigValue("Global", "lines_show", "Only", True)
00087 linz = self.getConfigValue("Global", "lines_zoom", globalStrings.DISP_SETT_COUNTRY_STATE, True)
00088
00089 return (lins, linz)
00090
00091
00092
00093
00094
00095 def glb_getLabelOptions(self):
00096 labs = self.getConfigValue("Global", "labels_show", "Only", True)
00097 labz = self.getConfigValue("Global", "labels_zoom", globalStrings.DISP_SETT_COUNTRY_STATE, True)
00098
00099 return (labs, labz)
00100
00101
00102
00103
00104 def glb_getDisplayScale(self):
00105 dispXs = self.getConfigValue("Global", "display_xfer_scale", "1000000", True)
00106 return int(dispXs)
00107
00108
00109
00110
00111 def glb_getRefreshRate(self):
00112 refRate = self.getConfigValue("Global", "map_refresh_rate", "Med", True)
00113
00114 return refRate
00115
00116
00117
00118
00119 def glb_getDisplayLabel(self):
00120 displayLabel = self.getConfigValue("Global", "display_label", "_DEFAULT_", True)
00121
00122 return displayLabel
00123
00124
00125
00126
00127
00128 def app_getProcessColorCodes(self):
00129 return self.getSection("AppColorCodes")
00130
00131
00132
00133 def app_getProcessColorCodesDict(self):
00134 procColorDict = dict()
00135 procColorList = self.app_getProcessColorCodes()
00136
00137 for proc, color in procColorList:
00138 procColorDict[proc] = color
00139
00140 return procColorDict
00141
00142
00143
00144 def app_getProcessDefaultColor(self):
00145 procDefColor = self.getConfigValue("Application", "proc_default_color", "#FF0000", True)
00146
00147 return procDefColor
00148
00149
00150
00151 def map_getMapDetail(self):
00152 mapDetailLevel = self.getConfigValue("Map", "map_detail_level", "N", True)
00153
00154 if mapDetailLevel == "Y":
00155 mapDetailLevel = True
00156 else:
00157 mapDetailLevel = False
00158
00159 return mapDetailLevel
00160
00161
00162
00163
00164
00165 def map_getDrawCSBorders(self):
00166 drawCSBorders = self.getConfigValue("Map", "map_draw_cs_borders", "Y", True)
00167
00168 if drawCSBorders == "Y":
00169 drawCSBorders = True
00170 else:
00171 drawCSBorders = False
00172
00173 return drawCSBorders
00174
00175
00176
00177
00178
00179 def map_getDrawRivers(self):
00180 drawRivers = self.getConfigValue("Map", "map_draw_rivers", "N", True)
00181
00182 if drawRivers == "Y":
00183 drawRivers = True
00184 else:
00185 drawRivers = False
00186
00187 return drawRivers
00188
00189
00190
00191 """
00192 --- Setters ---
00193 """
00194
00195
00196
00197
00198
00199
00200 def glb_setMinXferOptions(self, (mdxh, mdx, mdxs)):
00201 mdxh = str(mdxh)
00202 mdx = str(mdx)
00203 mdxs = str(mdxs)
00204
00205 self.setConfigValue("Global", "min_data_xfer_hide", mdxh)
00206 self.setConfigValue("Global", "min_data_xfer", mdx)
00207 self.setConfigValue("Global", "min_data_xfer_scale", mdxs)
00208
00209
00210
00211
00212
00213
00214 def glb_setMaxIdleOptions(self, (mith, mit, mits)):
00215 mith = str(mith)
00216 mit = str(mit)
00217 mts = str(mits)
00218
00219 self.setConfigValue("Global", "max_idle_time_hide", mith)
00220 self.setConfigValue("Global", "max_idle_time", mit)
00221 self.setConfigValue("Global", "max_idle_time_scale", mits)
00222
00223
00224
00225
00226
00227
00228 def glb_setLineOptions(self, (lins, linz)):
00229 lins = str(lins)
00230 linz = str(linz)
00231
00232 self.setConfigValue("Global", "lines_show", lins)
00233 self.setConfigValue("Global", "lines_zoom", linz)
00234
00235
00236
00237
00238
00239 def glb_setLabelOptions(self, (labs, labz)):
00240 labs = str(labs)
00241 labz = str(labz)
00242
00243 self.setConfigValue("Global", "labels_show", labs)
00244 self.setConfigValue("Global", "labels_zoom", labz)
00245
00246
00247
00248
00249 def glb_setDisplayScale(self, dispXs):
00250 dispXs = str(dispXs)
00251
00252 self.setConfigValue("Global", "display_xfer_scale", dispXs)
00253
00254
00255
00256
00257
00258 def glb_setRefreshRate(self, refRate):
00259 refRate = str(refRate)
00260
00261 self.setConfigValue("Global", "map_refresh_rate", refRate)
00262
00263
00264
00265
00266
00267 def glb_setDisplayLabel(self, displayLabel):
00268 self.setConfigValue("Global", "display_label", displayLabel)
00269
00270
00271
00272
00273 def app_setProcessColorCodes(self, colorCodeDict):
00274 for processName, color in colorCodeDict.iteritems():
00275 self.setConfigValue("AppColorCodes", processName, color)
00276
00277
00278
00279
00280
00281 def app_setProcessDefaultColor(self, defColor):
00282 self.setConfigValue("Application", "proc_default_color", defColor)
00283
00284
00285
00286 def map_setMapDetail(self, value):
00287 if value == True: value = 'Y'
00288 else: value = 'N'
00289
00290 self.setConfigValue("Map", "map_detail_level", value)
00291
00292
00293
00294
00295
00296 def map_setDrawCSBorders(self, value):
00297 if value == True: value = 'Y'
00298 else: value = 'N'
00299
00300 self.setConfigValue("Map", "map_draw_cs_borders", value)
00301
00302
00303
00304
00305
00306 def map_setDrawRivers(self, value):
00307 if value == True: value = 'Y'
00308 else: value = 'N'
00309
00310 self.setConfigValue("Map", "map_draw_rivers", value)
00311
00312
00313
00314
00315
00316
00317