Beispiel #1
0
class Meter(object):

    canvas  = None;
    widgets = None;
    height  = None;
    width   = None;

    def __init__(self, width, height):
        self.canvas = Canvas();
        handler = MeterEventHandler(self);
        self.canvas.setup("below", handler);
        self.canvas.set_size(width, height);
        self.width = width;
        self.height = height;
        self.widgets = [];

    def add_widget(self, widget, x, y, x_alignment = -1, y_alignment = -1):
        self.widgets.append((widget, x, y, x_alignment, y_alignment));

    def refresh_func(self):
        self.canvas.redraw();
        return self.canvas.get_mapped();

    def show(self):
        self.canvas.show();
        GLib.timeout_add(200, self.refresh_func);

    def hide(self):
        self.canvas.hide();
        
    def get_window(self):
        return self.canvas.get_window();
Beispiel #2
0
class Meter(object):

  canvas = None;
  handler = None;
  width = None;
  height = None;
  hour_radius = None;
  min_radius = None;
  sec_radius = None;
  padding = 5;
  fill_color = None;
  opacity = None;
  
  def __init__(self, width, height):
    self.canvas = Canvas();
    handler = MeterEventHandler(self);
    self.canvas.setup("below", handler);
    self.canvas.set_size(width, height);
    
    self.width = width;
    self.height = height;
    self.hour_radius = 4;
    self.min_radius = 8;
    self.sec_radius = 6;
    self.padding = 5;
    # self.fill_color = (0.3, 0.7, 0.1);
    self.fill_color = (1.0, 1.0, 1.0);
    self.opacity = 0.5;

  def refresh_thread(self):
    self.canvas.redraw();
    return self.canvas.get_mapped();

  def show(self):
    self.canvas.show();
    GLib.timeout_add(200, self.refresh_thread);

  def hide(self):
    self.canvas.hide();

  def get_window(self):
    return self.canvas.get_window();