def __init__(self, parent, log): self.controls = [None, None, None, None, None] self.timeStart = None self.log = log wx.StatusBar.__init__(self, parent, -1) self.SetFieldsCount(len(self.controls)) self.controls[0] = wx.StaticText(self, label=self.TEXT_GENERAL, style=wx.ST_NO_AUTORESIZE) self.controls[1] = wx.StaticText(self, label=self.TEXT_INFO, style=wx.ST_NO_AUTORESIZE) self.controls[2] = Led(self, label=self.TEXT_GPS) self.controls[3] = wx.Gauge(self, -1, style=wx.GA_HORIZONTAL | wx.GA_SMOOTH) animation = Animation(get_resource('busy.gif')) busy = AnimationCtrl(self, anim=animation) busy.SetToolTip('Updating plot') self.controls[4] = busy self.controls[3].Hide() self.controls[4].Hide() self.SetStatusWidths([-1, -1, -1, -1, busy.GetSize()[0] * 4]) self.Bind(wx.EVT_SIZE, self.__on_size) wx.CallAfter(self.__on_size, None) self.Fit()
def __send_file(self): url = urlparse(self.path) _dir, filename = os.path.split(url.path) localFile = get_resource(filename) if os.path.isdir(localFile) or not os.path.exists(localFile): self.send_error(404) self.log_message('File not found: {}'.format(self.path), Log.WARN) return urlFile = pathname2url(localFile) self.send_response(200) self.send_header('Content-type', mimetypes.guess_type(urlFile)[0]) self.end_headers() f = open(localFile, 'rb') self.wfile.write(f.read()) f.close()
def load_icon(name): filename = get_resource(name + '.png') return wx.Icon(filename, wx.BITMAP_TYPE_PNG)
def load_bitmap(name): filename = get_resource(name + '.png') return wx.Bitmap(filename, wx.BITMAP_TYPE_PNG)