def refresh(self):
     container_remove_all(self.camera_box)
     container_remove_all(self.under_camera_box)
     if Webcam.has_device():
         self.under_camera_box.pack_start(self.start_record_button)
     else:
         self.under_camera_box.pack_start(self.no_device_warning)        
    def __camera_box_expose(self, widget, event):
        cr = widget.window.cairo_create()
        x, y, w, h = widget.allocation
        # draw frame
        with cairo_disable_antialias(cr):
            cr.rectangle(x, y, w, h)
            cr.set_line_width(1)
            cr.set_source_rgb(*color_hex_to_cairo("#a2a2a2"))
            cr.stroke()
        # draw background
        cr.rectangle(x + 5, y + 5, w - 10, h - 10)
        cr.set_source_rgb(*color_hex_to_cairo("#333333"))
        cr.fill()

        # draw camera icon
        if hasattr(self, "scanning") and self.scanning:
            draw_pixbuf(cr, self.snapshot_pixbuf,
                        x = x + (CAMERA_BOX_SIZE - self.snapshot_pixbuf.get_width()) / 2,
                        y = y + (CAMERA_BOX_SIZE - self.snapshot_pixbuf.get_height()) / 2)
        else:
            draw_pixbuf(cr, self.camera_pixbuf,
                        x = x + (CAMERA_BOX_SIZE - self.camera_pixbuf.get_width()) / 2,
                        y = y + (CAMERA_BOX_SIZE - self.camera_pixbuf.get_height()) / 2)
            if not Webcam.has_device():
                draw_pixbuf(cr, self.error_pixbuf,
                            x = x + (CAMERA_BOX_SIZE - self.camera_pixbuf.get_width()) / 2 + 12,
                            y = y + (CAMERA_BOX_SIZE - self.camera_pixbuf.get_height()) / 2 + 12)
    def __init__(self, account_setting):
        gtk.VBox.__init__(self)
        self.account_setting = account_setting
        
        self.camera_pixbuf = app_theme.get_pixbuf("account/camera.png").get_pixbuf()
        self.error_pixbuf = app_theme.get_pixbuf("account/error.png").get_pixbuf()
        self.success_pixbuf = app_theme.get_pixbuf("account/success.png").get_pixbuf()

        self.camera_box_align = gtk.Alignment(0.5, 0, 0, 0)
        self.camera_box = gtk.VBox()
        self.camera_box.set_size_request(CAMERA_BOX_SIZE, CAMERA_BOX_SIZE)
        self.camera_box.connect("expose-event", self.__camera_box_expose)
        self.camera_box_align.add(self.camera_box)

        self.under_camera_box = gtk.VBox(spacing=10)
        self.under_camera_box_align = gtk.Alignment(0.5, 0, 0, 0)
        self.under_camera_box_align.set_padding(WIDGET_SPACING, 0, 0, 0)
        self.under_camera_box_align.add(self.under_camera_box)
        self.__init_widgets()
        if Webcam.has_device():
            self.under_camera_box.pack_start(self.start_record_button)
        else:
            self.under_camera_box.pack_start(self.no_device_warning)

        self.pack_start(self.camera_box_align, False, False)
        self.pack_start(self.under_camera_box_align, False, False)
Beispiel #4
0
    def __init__(self, account_setting):
        gtk.VBox.__init__(self)
        self.account_setting = account_setting

        self.camera_pixbuf = app_theme.get_pixbuf(
            "account/camera.png").get_pixbuf()
        self.error_pixbuf = app_theme.get_pixbuf(
            "account/error.png").get_pixbuf()
        self.success_pixbuf = app_theme.get_pixbuf(
            "account/success.png").get_pixbuf()

        self.camera_box_align = gtk.Alignment(0.5, 0, 0, 0)
        self.camera_box = gtk.VBox()
        self.camera_box.set_size_request(CAMERA_BOX_SIZE, CAMERA_BOX_SIZE)
        self.camera_box.connect("expose-event", self.__camera_box_expose)
        self.camera_box_align.add(self.camera_box)

        self.under_camera_box = gtk.VBox(spacing=10)
        self.under_camera_box_align = gtk.Alignment(0.5, 0, 0, 0)
        self.under_camera_box_align.set_padding(WIDGET_SPACING, 0, 0, 0)
        self.under_camera_box_align.add(self.under_camera_box)
        self.__init_widgets()
        if Webcam.has_device():
            self.under_camera_box.pack_start(self.start_record_button)
        else:
            self.under_camera_box.pack_start(self.no_device_warning)

        self.pack_start(self.camera_box_align, False, False)
        self.pack_start(self.under_camera_box_align, False, False)
Beispiel #5
0
 def refresh(self):
     container_remove_all(self.camera_box)
     container_remove_all(self.under_camera_box)
     if Webcam.has_device():
         self.under_camera_box.pack_start(self.start_record_button)
     else:
         self.under_camera_box.pack_start(self.no_device_warning)
Beispiel #6
0
    def __camera_box_expose(self, widget, event):
        cr = widget.window.cairo_create()
        x, y, w, h = widget.allocation
        # draw frame
        with cairo_disable_antialias(cr):
            cr.rectangle(x, y, w, h)
            cr.set_line_width(1)
            cr.set_source_rgb(*color_hex_to_cairo("#a2a2a2"))
            cr.stroke()
        # draw background
        cr.rectangle(x + 5, y + 5, w - 10, h - 10)
        cr.set_source_rgb(*color_hex_to_cairo("#333333"))
        cr.fill()

        # draw camera icon
        if hasattr(self, "scanning") and self.scanning:
            draw_pixbuf(
                cr,
                self.snapshot_pixbuf,
                x=x + (CAMERA_BOX_SIZE - self.snapshot_pixbuf.get_width()) / 2,
                y=y +
                (CAMERA_BOX_SIZE - self.snapshot_pixbuf.get_height()) / 2)
        else:
            draw_pixbuf(
                cr,
                self.camera_pixbuf,
                x=x + (CAMERA_BOX_SIZE - self.camera_pixbuf.get_width()) / 2,
                y=y + (CAMERA_BOX_SIZE - self.camera_pixbuf.get_height()) / 2)
            if not Webcam.has_device():
                draw_pixbuf(
                    cr,
                    self.error_pixbuf,
                    x=x +
                    (CAMERA_BOX_SIZE - self.camera_pixbuf.get_width()) / 2 +
                    12,
                    y=y +
                    (CAMERA_BOX_SIZE - self.camera_pixbuf.get_height()) / 2 +
                    12)
 def is_has_camera(self):
     return Webcam.has_device()
Beispiel #8
0
 def is_has_camera(self):
     return Webcam.has_device()