home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.2)
-
- from wxPython.wx import *
-
- class Default:
-
- def __init__(self):
- self.BgOutline = wxPen(wxColour(10, 36, 106))
- self.BgColor = wxBrush(wxColour(194, 200, 218), wxSOLID)
- self.BgEmpty = wxBrush(wxColour(255, 255, 255), wxSOLID)
- self.FgColor = wxColour(0, 0, 0)
- self.FgFont = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, False, '', wxFONTENCODING_SYSTEM)
-
-
- def Update(self, grid, attr, dc, rect, row, col, isSelected):
- self.Grid = grid
- self.Attr = attr
- self.DC = dc
- self.Rect = rect
- self.Row = row
- self.Col = col
- self.IsSelected = isSelected
- self.Value = grid.GetCellValue(row, col)
- self.ValueStr = str(self.Value)
-
-
- def Draw(self, grid, attr, dc, rect, row, col, isSelected):
- self.Update(grid, attr, dc, rect, row, col, isSelected)
- self.DrawBackground()
- self.DrawForeground()
-
-
- def DrawBackground(self):
- pass
-
-
- def DrawForeground(self):
-
- try:
- self.Rect.width = self.Rect.width - 8
- self.Clip()
- self.DC.SetTextForeground(self.FgColor)
- self.DC.SetFont(self.FgFont)
- self.DC.DrawText(self.ValueStr, self.Rect.x + 6, self.Rect.y + 4)
- finally:
- self.Unclip()
-
-
-
- def Clip(self):
- self.DC.SetClippingRegion(self.Rect.x, self.Rect.y, self.Rect.width, self.Rect.height)
-
-
- def Unclip(self):
- self.DC.DestroyClippingRegion()
-
-
-
- class ProgressBar(Default):
-
- def __init__(self):
- Default.__init__(self)
- self.BarHashDone = wxColour(224, 0, 0)
- self.BarHashRemain = wxColour(0, 210, 255)
- self.BarLoadDone = wxColour(0, 244, 0)
- self.BarLoadRemain = wxColour(224, 0, 0)
-
-
- def DrawForeground(self):
- if self.ValueStr == '':
- return None
-
- done = float(self.ValueStr)
- remain = 1 - done
- done_width = self.Rect.width * done
- remain_start = self.Rect.x + done_width
- remain_width = self.Rect.width - done_width
- if done != -1.0:
- status = self.Grid.GetCellValue(self.Row, 5)
- if status == 'Hashing' or status == 'Allocating':
- color_done = self.BarHashDone
- color_remain = self.BarHashRemain
- else:
- color_done = self.BarLoadDone
- color_remain = self.BarLoadRemain
- self.DrawBCBGradient(wxRect(remain_start, self.Rect.y + 3, remain_width, self.Rect.height - 6), color_remain, 7)
- self.DrawBCBGradient(wxRect(self.Rect.x, self.Rect.y + 3, done_width, self.Rect.height - 6), color_done, 7)
- else:
- self.DrawBCBGradient(wxRect(self.Rect.x, self.Rect.y + 3, self.Rect.width, self.Rect.height - 6), wxColour(0, 210, 255), 7)
-
-
- def DrawBCBGradient(self, rect, color, gradheight):
- if rect.height < 2 * gradheight:
- return None
-
- self.DrawGradient(wxRect(rect.x, rect.y, rect.width, gradheight), wxColour(0, 0, 0), color)
- self.DC.SetPen(wxTRANSPARENT_PEN)
- self.DC.SetBrush(wxBrush(color, wxSOLID))
- self.DC.DrawRectangle(rect.x, rect.y + gradheight, rect.width, rect.height - 2 * gradheight)
- self.DrawGradient(wxRect(rect.x, rect.y + rect.height - gradheight, rect.width, gradheight), color, wxColour(0, 0, 0))
-
-
- def DrawGradient(self, rect, color_start, color_end):
- steps = rect.height
- r_dif = color_end.Red() - color_start.Red()
- g_dif = color_end.Green() - color_start.Green()
- b_dif = color_end.Blue() - color_start.Blue()
- length = rect.x + rect.width
- for y in range(steps):
- mod = float(y) / float(steps - 1)
- color = wxColour(color_start.Red() + mod * r_dif, color_start.Green() + mod * g_dif, color_start.Blue() + mod * b_dif)
- self.DC.SetPen(wxPen(color))
- self.DC.DrawLine(rect.x, rect.y + y, length, rect.y + y)
-
-
-
-