示例#1
0
    def __init__(self, parent=None, width=None, height=None, tester=False):
        """If tester is active, edition cappabilities are available"""
        if not parent:
            parent = context.get_mainwindow()
        size = context.get_mainwindow().get_size()
        width = int(size[0] / 2.2)
        height = int(size[1] / 2.0)
        hprop = size[1] / 1080.0
        gtk.Window.__init__(self)
        self.set_transient_for(parent)
        self.set_destroy_with_parent(True)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLBAR)
        self.set_title("Profile Selector")
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.set_default_size(width, height)
        self.set_skip_taskbar_hint(True)
        self.set_keep_above(True)

        strip = Header(size=size, title="Profile Selector")

        self.notebook = gtk.Notebook()
        self.notebook.set_show_tabs(False)

        box = gtk.VBox()
        box.pack_start(strip, False, False, int(0))
        strip.show()
        box.pack_start(self.notebook, True, True, 0)
        self.add(box)
        self.list = ListProfileBox(self, size, tester)
        self.profile = None
        self.track = None

        tab1 = gtk.Label("Profile Selector")
        self.append_tab(self.list, tab1)
        self.show_all()
示例#2
0
    def set_status_view(self):
        """Set the message and color of the status pilot on the top bar"""

        size = context.get_mainwindow().get_size()
        k1 = size[0] / 1920.0

        l = Gtk.ListStore(str,str,str)

        main_window = context.get_mainwindow()
        main_window.realize()

        for i in STATUSES:
            l.append([_(i.description), i.bg_color, i.fg_color])

        v = Gtk.CellView()
        v.set_model(l)
        v.get_style_context().add_class('label_extrabig')

        r = Gtk.CellRendererText()
        self.renderer=r
        r.set_alignment(0.5,0.5)

        v.pack_start(r,True)
        v.add_attribute(r, "text", 0)
        v.add_attribute(r, "background", 1)
        v.add_attribute(r, "foreground", 2)
        v.set_displayed_row(Gtk.TreePath(0))
        relabel(v,k1*42,True)
        return v
示例#3
0
    def set_status_view(self):
        """Set the message and color of the status pilot on the top bar"""

        size = context.get_mainwindow().get_size()
        k1 = size[0] / 1920.0

        l = Gtk.ListStore(str, str, str)

        main_window = context.get_mainwindow()
        main_window.realize()

        for i in STATUSES:
            l.append([_(i.description), i.bg_color, i.fg_color])

        v = Gtk.CellView()
        v.set_model(l)
        v.get_style_context().add_class('label_extrabig')

        r = Gtk.CellRendererText()
        self.renderer = r
        r.set_alignment(0.5, 0.5)

        v.pack_start(r, True)
        v.add_attribute(r, "text", 0)
        v.add_attribute(r, "background", 1)
        v.add_attribute(r, "foreground", 2)
        v.set_displayed_row(Gtk.TreePath(0))
        relabel(v, k1 * 42, True)
        return v
示例#4
0
    def __init__(self, parent=None, width = None, height=None, tester=False):
        """If tester is active, edition cappabilities are available"""
        if not parent:
            parent = context.get_mainwindow()
        size = context.get_mainwindow().get_size()
        width = int(size[0]/2.2)
        height = int(size[1]/2.0)
        gtk.Window.__init__(self)
        self.set_title(" ")
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.set_default_size(width,height)
        self.set_modal(True)
        if parent:
            self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
            self.set_transient_for(parent)
            self.set_destroy_with_parent(True)

        self.notebook = gtk.Notebook()
        self.notebook.set_show_tabs(False)
        self.add(self.notebook)
        
        self.list=ListProfileBox(self, size, tester)
        self.profile=None
        self.track=None       

        tab1 = gtk.Label("Profile Selector")
        self.append_tab(self.list,tab1)
        self.show_all()
示例#5
0
    def __init__(self, parent=None, width = None, height=None, tester=False):
        """If tester is active, edition cappabilities are available"""
        if not parent:
            parent = context.get_mainwindow()
        size = context.get_mainwindow().get_size()
        width = int(size[0]/2.2)
        height = int(size[1]/2.0)
        hprop = size[1]/1080.0
        gtk.Window.__init__(self)
        self.set_transient_for(parent)
        self.set_destroy_with_parent(True)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLBAR)
        self.set_title("Profile Selector")
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.set_default_size(width,height)
        self.set_skip_taskbar_hint(True)
        self.set_keep_above(True)

        strip = Header(size=size,title="Profile Selector")

        self.notebook = gtk.Notebook()
        self.notebook.set_show_tabs(False)

        box = gtk.VBox()
        box.pack_start(strip, False, False, int(0))
        strip.show()
        box.pack_start(self.notebook, True, True, 0)
        self.add(box)        
        self.list=ListProfileBox(self, size, tester)
        self.profile=None
        self.track=None       

        tab1 = gtk.Label("Profile Selector")
        self.append_tab(self.list,tab1)
        self.show_all()
示例#6
0
     def __init__(self, parent=None):
         if not parent:
             parent = context.get_mainwindow()
         gtk.AboutDialog.__init__(self)
         if parent:
             self.set_transient_for(parent)
         
         size=context.get_mainwindow().get_size()
         a=0.3*size[0]
         b=0.5*size[1]
         k = size[0]/1920.0
         self.set_resizable(True)
         self.set_default_size(int(0.3*size[0]),int(0.4*size[1]))
         self.set_title("About Galicaster "+__version__)
         
         #self.set_decorated(True)
         self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

         self.set_program_name(PROGRAM)
         self.set_version(__version__)
         self.set_website(WEB)
         self.set_website_label("Galicaster Website")
         self.set_authors(AUTHORS)
         self.set_documenters(DOCS)
         self.set_artists(ARTISTS)
         self.set_copyright("\n".join((COPY1,COPY2)))
         self.set_license(LICENSE)
         pixbuf = gtk.gdk.pixbuf_new_from_file(get_image_path('logo.svg')) 
         pixbuf = pixbuf.scale_simple(
              int(pixbuf.get_width()*k),
              int(pixbuf.get_height()*k),
              gtk.gdk.INTERP_BILINEAR)

         self.set_logo(pixbuf)

         #ADD TELTEK LOGO
         box=self.get_content_area()
         company_logo=gtk.Image()
         pixbuf = gtk.gdk.pixbuf_new_from_file(get_image_path('teltek.svg')) 
         pixbuf = pixbuf.scale_simple(
              int(pixbuf.get_width()*k),
              int(pixbuf.get_height()*k),
            gtk.gdk.INTERP_BILINEAR)

         company_logo.set_from_pixbuf(pixbuf)

         box.pack_end(company_logo,True,True,0)
         company_logo.show()

         #ADD THANKS
         #thanks=gtk.Button("Thanks")
         #buttons=self.get_action_area()
         #thanks.connect("clicked",self.show_thanks)
         #buttons.pack_start(thanks)
         #buttons.reorder_child(thanks,0)
         #thanks.show()

         self.run()
         self.destroy()
示例#7
0
 def dialog_destroy(self, origin=None):
     global instance
     if self.dialog:
         context.get_mainwindow().get_style_context().remove_class('shaded')
         self.dialog.destroy()
         self.dialog = None
     instance = None
     self.dispatcher.emit("action-audio-enable-msg")
示例#8
0
def load_ui(element):
    try:
        builder = context.get_mainwindow().nbox.get_nth_page(PAGES["REC"]).gui
    except Exception:
        logger.debug("The view not exist")
        return None

    notebook = builder.get_object("data_panel")
    builder = Gtk.Builder()
    label = Gtk.Label("Camera Control")

    builder.add_from_file(get_ui_path("camera_control.glade"))
    notebook2 = builder.get_object("notebook1")
    label2 = builder.get_object("label2")
    label3 = builder.get_object("label3")
    label1 = builder.get_object("label1")
    label4 = builder.get_object("label4")
    label_style(label)
    label_style(label2, True)
    label_style(label3, True)
    label_style(label1, True, 12)
    label_style(label4, True, 12)
    notebook.append_page(notebook2, label)
    builder.connect_signals(event_handler)

    zoom_levels = conf.get_int('cameracontrol', 'zoom_levels')
    max_speed_pan_tilt = conf.get('cameracontrol', 'max_speed_pan_tilt')
    speed_zoom = builder.get_object("adjustment1")
    speed_pan_tilt = builder.get_object("adjustment2")
    speed_zoom.set_upper(zoom_levels)
    speed_pan_tilt.set_upper(int(max_speed_pan_tilt, 16))

    speed_pan_tilt.set_value(int(max_speed_pan_tilt, 16) / 2)
    speed_zoom.set_value(zoom_levels / 2)

    grid = builder.get_object("grid1")
    size = context.get_mainwindow().get_size()
    k1 = size[0] / 1920.0
    for button in grid.get_children():
        try:
            image = button.get_children()
            if type(image[0]) == Gtk.Image:
                image[0].set_pixel_size(k1 * 40)
        except:
            pass

    admin = conf.get_boolean('basic', 'admin')
    for widget in ["grid2", "grid3"]:
        for button in builder.get_object(widget):
            if admin and "save" in button.get_name():
                button.show_all()
            image = button.get_children()
            if type(image[0]) == Gtk.Image:
                image[0].set_pixel_size(int(k1 * 40))
            else:
                image[0].set_use_markup(True)
                image[0].modify_font(Pango.FontDescription(str(int(k1 * 20))))
    def dialog_destroy(self, origin=None):
        global instance
        if self.dialog:
            context.get_mainwindow().get_style_context().remove_class('shaded')
            self.dialog.destroy()
            self.dialog = None
        instance = None

        self.dispatcher.emit("action-audio-enable-msg")
示例#10
0
     def __init__(self, parent=None):
         if not parent:
             parent = context.get_mainwindow()
         Gtk.AboutDialog.__init__(self)
#         GObject.GObject.__init__(self)
         if parent:
             self.set_transient_for(parent)
         
         size=context.get_mainwindow().get_size()
         k = size[0]/1920.0
         self.set_resizable(True)
         self.set_default_size(int(0.3*size[0]),int(0.4*size[1]))
         self.set_title(_("About Galicaster {version}").format(version = __version__))
         
         strip = Header(size=size, title=_("About"))
         self.vbox.pack_start(strip, False, True, 0)
         self.vbox.reorder_child(strip,0)
         strip.show()
         self.set_type_hint(Gdk.WindowTypeHint.TOOLBAR)
         
         #self.set_decorated(True)
         self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)

         self.set_program_name(PROGRAM)
         self.set_version(__version__)
         self.set_website(WEB)
         self.set_website_label(_("Galicaster Website"))
         self.set_authors(AUTHORS)
         self.set_documenters(DOCS)
         self.set_artists(ARTISTS)
         self.set_copyright(COPY)
         self.set_license(LICENSE)
         pixbuf = GdkPixbuf.Pixbuf.new_from_file(get_image_path('logo.svg')) 
         pixbuf = pixbuf.scale_simple(
              int(pixbuf.get_width()*k),
              int(pixbuf.get_height()*k),
              GdkPixbuf.InterpType.BILINEAR)

         #self.set_logo(pixbuf)

         #ADD TELTEK LOGO
         box=self.get_content_area()
         company_logo=Gtk.Image()
         pixbuf = GdkPixbuf.Pixbuf.new_from_file(get_image_path('teltek.svg')) 
         pixbuf = pixbuf.scale_simple(
              int(pixbuf.get_width()*k),
              int(pixbuf.get_height()*k),
            GdkPixbuf.InterpType.BILINEAR)

         company_logo.set_from_pixbuf(pixbuf)

         box.pack_end(company_logo,True,True,0)
         company_logo.show()
示例#11
0
文件: about.py 项目: zenny/Galicaster
    def __init__(self, parent=None):
        if not parent:
            parent = context.get_mainwindow()
        gtk.AboutDialog.__init__(self)
        if parent:
            self.set_transient_for(parent)

        size = context.get_mainwindow().get_size()
        k = size[0] / 1920.0
        self.set_resizable(True)
        self.set_default_size(int(0.3 * size[0]), int(0.4 * size[1]))
        self.set_title(
            _("About Galicaster {version}").format(version=__version__))

        strip = Header(size=size, title=_("About"))
        self.vbox.pack_start(strip, False, True, 0)
        self.vbox.reorder_child(strip, 0)
        strip.show()
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLBAR)

        #self.set_decorated(True)
        self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

        self.set_program_name(PROGRAM)
        self.set_version(__version__)
        self.set_website(WEB)
        self.set_website_label(_("Galicaster Website"))
        self.set_authors(AUTHORS)
        self.set_documenters(DOCS)
        self.set_artists(ARTISTS)
        self.set_copyright(COPY)
        self.set_license(LICENSE)
        pixbuf = gtk.gdk.pixbuf_new_from_file(get_image_path('logo.svg'))
        pixbuf = pixbuf.scale_simple(int(pixbuf.get_width() * k),
                                     int(pixbuf.get_height() * k),
                                     gtk.gdk.INTERP_BILINEAR)

        #self.set_logo(pixbuf)

        #ADD TELTEK LOGO
        box = self.get_content_area()
        company_logo = gtk.Image()
        pixbuf = gtk.gdk.pixbuf_new_from_file(get_image_path('teltek.svg'))
        pixbuf = pixbuf.scale_simple(int(pixbuf.get_width() * k),
                                     int(pixbuf.get_height() * k),
                                     gtk.gdk.INTERP_BILINEAR)

        company_logo.set_from_pixbuf(pixbuf)

        box.pack_end(company_logo, True, True, 0)
        company_logo.show()
示例#12
0
def post_init(source=None):
    conf = context.get_conf()
    recorder_ui = context.get_mainwindow().nbox.get_nth_page(0).gui
    data_panel = recorder_ui.get_object('data_panel')

    # Customize tabs in the recorder UI
    try: 
        tabs_to_hide = set( x for x in set(conf.get('hidetabs', 'hide').split()) if x in ALL_TABS )
        if tabs_to_hide:
            for tab, obj_name in ALL_TABS.iteritems():
                page = recorder_ui.get_object(obj_name)
                if tab in tabs_to_hide:
                    page.hide()

    except AttributeError:
        # The conf parameter isn't defined. Ignore
        print "Attribute error"

    default_tab = conf.get('hidetabs', 'default') or None
    try:
        page = recorder_ui.get_object(ALL_TABS[default_tab])
        data_panel.set_current_page(data_panel.page_num(page))
    except KeyError:
        # The conf parameter isn't defined. Ignore
        pass
示例#13
0
    def do_resize(self, buttonlist, secondlist=[]):
        """Force a resize on the Media Manager"""
        size = context.get_mainwindow().get_size()
        self.strip.resize()
        altura = size[1]
        anchura = size[0]

        k1 = anchura / 1920.0
        k2 = altura / 1080.0
        self.proportion = k1

        for name in buttonlist:
            button = self.gui.get_object(name)
            button.set_property("width-request", int(k1 * 100))
            button.set_property("height-request", int(k1 * 100))

            resize_button(button, size_image=k1 * 80, size_vbox=k1 * 46)

        for name in secondlist:
            button2 = self.gui.get_object(name)
            button2.set_property("width-request", int(k2 * 85))
            button2.set_property("height-request", int(k2 * 85))

            resize_button(button2.get_children()[0],
                          size_image=k1 * 56,
                          size_vbox=k1 * 46)

        return True
示例#14
0
def post_init(_source):
    """
    Plugin initialized
    """
    recorder_ui = context.get_mainwindow().nbox.get_nth_page(0).gui

    try:
        if conf.get_boolean('basic', 'admin'):
            logger.info("Admin mode is set to true")
            return
        button_names = set(conf.get('hidebuttons', 'hide').split())
        if not button_names:
            logger.warn("No buttons specified in configuration to hide")
            return
        buttons_to_hide = set(ALL_BUTTONS.keys()).intersection(button_names)
        logger.info("Hiding buttons: {}".format(', '.join(buttons_to_hide)))
        if buttons_to_hide:
            for button_to_hide in buttons_to_hide:
                button = recorder_ui.get_object(ALL_BUTTONS[button_to_hide])
                if button:
                    if not button.get_realized():
                        logger.warn("Hiding button `{}` though it is already hidden...".format(button_to_hide))
                    button.hide()
    except Exception:
        # The conf parameter isn't defined. Ignore
        logger.warn("Plugin enabled but not configured, see documentation on "
                    "setting the 'hide' configuration option for this plugin")
示例#15
0
def on_key_press(element, source, event):
    if context.get_mainwindow().get_current_page() == PAGES["REC"]:
        if event.keyval == Gdk.keyval_from_name("Up"):
            logger.debug("Key pressed: up")
            event_handler.on_up()

        if event.keyval == Gdk.keyval_from_name("Right"):
            logger.debug("Key pressed: right")
            event_handler.on_right()

        if event.keyval == Gdk.keyval_from_name("Down"):
            logger.debug("Key pressed: down")
            event_handler.on_down()

        if event.keyval == Gdk.keyval_from_name("Left"):
            logger.debug("Key pressed: left")
            event_handler.on_left()

        if event.keyval == Gdk.keyval_from_name("plus"):
            logger.debug("Key pressed: zoom_in")
            event_handler.zoom_in()

        if event.keyval == Gdk.keyval_from_name("minus"):
            logger.debug("Key pressed: zoom_out")
            event_handler.zoom_out()
示例#16
0
    def resize(self): 
        """Adapts GUI elements to the screen size"""
        size = context.get_mainwindow().get_size()
        anchura = size[0]
        k = anchura / 1920.0

        pixbuf = GdkPixbuf.Pixbuf.new_from_file(get_image_path('logo.svg'))    
        pixbuf = pixbuf.scale_simple(
            int(pixbuf.get_width()*k),
            int(pixbuf.get_height()*k),
            GdkPixbuf.InterpType.BILINEAR)
        align2 = self.builder.get_object("top_align")
        
        logo2 = self.builder.get_object("logo2")

        logo2.set_from_pixbuf(pixbuf)
        align2.set_padding(int(k*51),int(k*30),0,0)

        for name in ["previousbutton"]:
            button = self.builder.get_object(name)
            button.set_property("width-request", int(k*70) )
            button.set_property("height-request", int(k*70) )
            
            image = button.get_children()
            if type(image[0]) == Gtk.Image:
                image[0].set_pixel_size(int(k*56))
示例#17
0
def show_msg(element=None, *args):
    text = {"title" : _("Lock screen"),
            "main" : _("Please insert the password")}

    show = []
    auth_method = conf.get_choice('lockscreen', 'authentication', ['basic', 'ldap'], 'basic')
    quit_button = conf.get_boolean('lockscreen','enable_quit_button')

    if auth_method == "ldap":
        show = ["username_label","username_entry"]
        text = {"title" : _("Lock screen"),
            "main" : _("LDAP authentication")}
    if quit_button:
        show.append("quitbutton")

    if not args:
        for page in PAGES_LOADED:
            button = show_buttons(page)
            if button is not None:
                button.connect("clicked", lock, text, show)

        #FIXME Change behaviour of stop dialog, to avoid shaded lockscreen
        recorderui =  context.get_mainwindow().nbox.get_nth_page(0)
        recorderui.close_before_response_action = True

    lock(None,text,show)
示例#18
0
 def show_about_dialog(self,origin, button):
     about_dialog = GCAboutDialog()
     about_dialog.set_transient_for(context.get_mainwindow())
     about_dialog.set_modal(True)
     about_dialog.set_keep_above(False)
     about_dialog.show()
     about_dialog.connect('response', self.on_about_dialog_response)
示例#19
0
    def resize(self):
        """Adapts GUI elements to the screen size"""
        size = context.get_mainwindow().get_size()
        anchura = size[0]
        k = anchura / 1920.0

        pixbuf = gtk.gdk.pixbuf_new_from_file(get_image_path('logo.svg'))
        pixbuf = pixbuf.scale_simple(int(pixbuf.get_width() * k),
                                     int(pixbuf.get_height() * k),
                                     gtk.gdk.INTERP_BILINEAR)
        align2 = self.builder.get_object("top_align")

        logo2 = self.builder.get_object("logo2")

        logo2.set_from_pixbuf(pixbuf)
        align2.set_padding(int(k * 51), int(k * 30), 0, 0)

        for name in ["previousbutton"]:
            button = self.builder.get_object(name)
            button.set_property("width-request", int(k * 70))
            button.set_property("height-request", int(k * 70))

            image = button.get_children()
            if type(image[0]) == gtk.Image:
                image[0].set_pixel_size(int(k * 56))
示例#20
0
def post_init(source=None):
    conf = context.get_conf()
    recorder_ui = context.get_mainwindow().nbox.get_nth_page(0).gui
    data_panel = recorder_ui.get_object('data_panel')

    # Customize tabs in the recorder UI
    try:
        tabs_to_hide = set(x
                           for x in set(conf.get('hidetabs', 'hide').split())
                           if x in ALL_TABS)
        if tabs_to_hide:
            for tab, obj_name in ALL_TABS.iteritems():
                page = recorder_ui.get_object(obj_name)
                if tab in tabs_to_hide:
                    page.hide()

    except AttributeError:
        # The conf parameter isn't defined. Ignore
        print "Attribute error"

    default_tab = conf.get('hidetabs', 'default') or None
    try:
        page = recorder_ui.get_object(ALL_TABS[default_tab])
        data_panel.set_current_page(data_panel.page_num(page))
    except KeyError:
        # The conf parameter isn't defined. Ignore
        pass
示例#21
0
def init():

    global recorder_ui
    global rec_button
    global metadata

    metadata = {}

    # Get a shallow copy of the plugin configuration
    config = context.get_conf().get_section('setuprecording') or {}

    # Get the metadata to setup the mediapackage defaults
    for key, value in config.iteritems():
        final_key = EQUIV.get(key) or key
        if final_key in DCTERMS:
            try:
                metadata[final_key] = value.format(**MAPPINGS)
            except KeyError:
                metadata[final_key] = value

    # Check the special case that series is specified using 'series' rather than 'isPartOf'
    if 'series' in config:
        metadata['isPartOf'] = config['series']

    recorder_ui = context.get_mainwindow().nbox.get_nth_page(0)

    rec_button = recorder_ui.gui.get_object('recbutton')

    rec_button.connect('clicked', on_rec)
    rec_button.handler_block_by_func(recorder_ui.on_rec)
示例#22
0
def post_init(source=None):

    global recorder_ui
    global rec_button
    global metadata

    metadata = {}
    
    # Get a shallow copy of the plugin configuration
    config = context.get_conf().get_section('setuprecording') or {}

    # Get the metadata to setup the mediapackage defaults
    for key, value in config.iteritems():
        final_key = EQUIV.get(key) or key
        if final_key in DCTERMS:
            try:
                metadata[final_key] = value.format(**MAPPINGS)
            except KeyError:
                metadata[final_key] = value

    # Check the special case that series is specified using 'series' rather than 'isPartOf'
    if 'series' in config:
        metadata['isPartOf'] = config['series']

    recorder_ui = context.get_mainwindow().nbox.get_nth_page(0)

    rec_button = recorder_ui.gui.get_object('recbutton')

    rec_button.connect('clicked', on_rec)
    rec_button.handler_block_by_func(recorder_ui.on_rec)
    def do_resize(self, buttonlist, secondlist=[]):
        """Force a resize on the Media Manager"""
        size = context.get_mainwindow().get_size()
        self.strip.resize()
        altura = size[1]
        anchura = size[0]

        k1 = anchura / 1920.0
        k2 = altura / 1080.0
        self.proportion = k1

        for name in buttonlist:
            button = self.gui.get_object(name)
            button.set_property("width-request", int(k1*100) )
            button.set_property("height-request", int(k1*100) )

            resize_button(button,size_image=k1*80,size_vbox=k1*46)

        for name in secondlist:
            button2 = self.gui.get_object(name)
            button2.set_property("width-request", int(k2*85) )
            button2.set_property("height-request", int(k2*85) )

            resize_button(button2.get_children()[0],size_image=k1*56,size_vbox=k1*46)

        return True
示例#24
0
 def launch_error_message(self, error_message):
     """Shows an active error message."""
     text = {
         "title": "Recorder",
         "main": " Please review your configuration \nor load another profile",
         "text": error_message,
     }
     self.error_dialog = message.PopUp(message.ERROR, text, context.get_mainwindow(), None)
 def info(self,key):
     """Pops up de MP info dialog"""
     logger.info("Info: {0}".format(str(key)))
     text = self.get_mp_info(key)
     text['title'] = 'Mediapackage Info'
     message.PopUp(message.MP_INFO, text,
                   context.get_mainwindow(),
                   response_action=self.create_mp_info_response(text['folder']),
                   close_on_response=False)
示例#26
0
    def __init__(self,package = None, parent = None):

        parent = context.get_mainwindow()
        size = parent.get_size()
            
        self.par = parent
        altura = size[1]
        anchura = size[0]        
        k1 = anchura / 1920.0                                      
        k2 = altura / 1080.0
        self.wprop = k1
        self.hprop = k2

        gui = gtk.Builder()
        gui.add_from_file(get_ui_path('metadata.glade'))

        dialog = gui.get_object("metadatadialog")
        dialog.set_property("width-request",int(anchura/2.2))
        dialog.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLBAR)
        dialog.set_keep_above(True)

        #NEW HEADER
        strip = Header(size=size, title="Edit Metadata")
        dialog.vbox.pack_start(strip, True, True, 0)
        dialog.vbox.reorder_child(strip,0)


        if parent != None:
            dialog.set_transient_for(parent.get_toplevel())

        
        table = gui.get_object('infobox')
        dialog.vbox.set_child_packing(table, True, True, int(self.hprop*25), gtk.PACK_END)    
        title = gui.get_object('title')
        sl = gui.get_object('slabel')
        cl = gui.get_object('clabel')
        talign = gui.get_object('table_align')

        modification = "bold "+str(int(k2*25))+"px"        
        title.modify_font(pango.FontDescription(modification))
        title.hide()
        talign.set_padding(int(k2*40),int(k2*40),0,0)
        mod2 = str(int(k1*35))+"px"        
        sl.modify_font(pango.FontDescription(mod2))
        cl.modify_font(pango.FontDescription(mod2))


        self.fill_metadata(table, package)
        talign.set_padding(int(self.hprop*25), int(self.hprop*10), int(self.hprop*25), int(self.hprop*25))
        dialog.vbox.set_child_packing(dialog.action_area, True, True, int(self.hprop*25), gtk.PACK_END)   
        dialog.show_all()
        dialog.present()

        return_value = dialog.run()
        if return_value == -8:
            self.update_metadata(table,package)
        dialog.destroy()
示例#27
0
 def on_dialog_response(self, origin, response_id):
     if response_id not in NEGATIVE and self.response_action:
         self.response_action(response_id, builder=self.gui, popup=self)
         if self.close_on_response:
             self.dialog_destroy()
     else:
         self.dialog_destroy()
         if self.close_parent:
             GObject.idle_add(context.get_mainwindow().do_quit)
示例#28
0
    def on_ask_stop(self,button):
        """GUI callback for stops preview or recording and closes the Mediapakage"""
        if self.conf.get_boolean("basic", "stopdialog"):
            text = {"title" : _("Recorder"),
                    "main" : _("Are you sure you want to\nstop the recording?")}
            buttons = (Gtk.STOCK_STOP, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)

            message.PopUp(message.WARN_STOP, text,
                          context.get_mainwindow(), buttons, self.on_stop_dialog_response, close_before_response_action = self.close_before_response_action)
示例#29
0
    def launch_error_message(self, error_message):
        """Shows an active error message."""
        text = {
            "title" : _("Recorder"),
            "main" : _(" Please review your configuration \nor load another profile"),                
            "text" : error_message
			}
        self.error_dialog = message.PopUp(message.ERROR, text, 
                                context.get_mainwindow(), None)
示例#30
0
    def on_ask_stop(self,button):
        """GUI callback for stops preview or recording and closes the Mediapakage"""
        if self.conf.get_boolean("basic", "stopdialog"):
            text = {"title" : _("Recorder"),
                    "main" : _("Are you sure you want to\nstop the recording?")}
            buttons = (Gtk.STOCK_STOP, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)

            message.PopUp(message.WARN_STOP, text,
                          context.get_mainwindow(), buttons, self.on_stop_dialog_response, close_before_response_action = self.close_before_response_action)
示例#31
0
 def show_about(self, button=None, tipe=None):
     """Pops up de About Dialgo"""
     about_dialog = GCAboutDialog()
     self.dispatcher.emit("disable-no-audio")
     about_dialog.set_transient_for(context.get_mainwindow())
     about_dialog.set_modal(True)
     about_dialog.set_keep_above(False)
     about_dialog.show()
     about_dialog.connect('response', self.on_about_dialog_response)
示例#32
0
 def show_about(self,button=None,tipe = None):
     """Pops up de About Dialgo"""
     about_dialog = GCAboutDialog()
     self.dispatcher.emit("disable-no-audio")
     about_dialog.set_transient_for(context.get_mainwindow())
     about_dialog.set_modal(True)
     about_dialog.set_keep_above(False)
     about_dialog.show()
     about_dialog.connect('response', self.on_about_dialog_response)
示例#33
0
    def set_status_view(self):
        """Set the message and color of the status pilot on the top bar"""

        size = context.get_mainwindow().get_size()
        # k1 = size[0] / 1920.0
        k2 = size[1] / 1080.0

        l = Gtk.ListStore(str,str,str)

        main_window = context.get_mainwindow()
        main_window.realize()
        
        style=main_window.get_style()

#        bgcolor = style.bg[Gtk.StateType.PRELIGHT]  
#        fgcolor = style.fg[Gtk.StateType.PRELIGHT]  

        for i in STATUS:
            if i[0] in ["Recording", "Error"]:
                l.append([_(i[0]), i[1], "#484848"])
            else:
                l.append([_(i[0]), "#F7F6F6", i[1]])
                
        v = Gtk.CellView()
        v.set_model(l)


        r = Gtk.CellRendererText()
        self.renderer=r
        r.set_alignment(0.5,0.5)
        r.set_fixed_size(int(k2*400),-1)


        # k1 = size[0] / 1920.0
        k2 = size[1] / 1080.0
        font = Pango.FontDescription("bold "+ str(int(k2*48)))
        r.set_property('font-desc', font)
        v.pack_start(r,True)
        v.add_attribute(r, "text", 0)
        v.add_attribute(r, "background", 1)   
        v.add_attribute(r, "foreground", 2)   
#        v.set_displayed_row(0)
        v.set_displayed_row(Gtk.TreePath(0))
        return v
示例#34
0
    def __init__(self, package=None, parent=None):

        parent = context.get_mainwindow()
        size = parent.get_size()

        self.par = parent
        altura = size[1]
        anchura = size[0]
        k1 = anchura / 1920.0
        k2 = altura / 1080.0
        self.wprop = k1
        self.hprop = k2

        gui = gtk.Builder()
        gui.add_from_file(get_ui_path('metadata.glade'))

        dialog = gui.get_object("metadatadialog")
        dialog.set_property("width-request", int(anchura / 2.2))
        dialog.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLBAR)
        dialog.set_keep_above(True)

        #NEW HEADER
        strip = Header(size=size, title="Edit Metadata")
        dialog.vbox.pack_start(strip, True, True, 0)
        dialog.vbox.reorder_child(strip, 0)

        if parent != None:
            dialog.set_transient_for(parent.get_toplevel())

        table = gui.get_object('infobox')
        dialog.vbox.set_child_packing(table, True, True, int(self.hprop * 25),
                                      gtk.PACK_END)
        title = gui.get_object('title')
        sl = gui.get_object('slabel')
        cl = gui.get_object('clabel')
        talign = gui.get_object('table_align')

        modification = "bold " + str(int(k2 * 25)) + "px"
        title.modify_font(pango.FontDescription(modification))
        title.hide()
        talign.set_padding(int(k2 * 40), int(k2 * 40), 0, 0)
        mod2 = str(int(k1 * 35)) + "px"
        sl.modify_font(pango.FontDescription(mod2))
        cl.modify_font(pango.FontDescription(mod2))

        self.fill_metadata(table, package)
        talign.set_padding(int(self.hprop * 25), int(self.hprop * 10),
                           int(self.hprop * 25), int(self.hprop * 25))
        dialog.vbox.set_child_packing(dialog.action_area, True, True,
                                      int(self.hprop * 25), gtk.PACK_END)
        dialog.show_all()

        return_value = dialog.run()
        if return_value == -8:
            self.update_metadata(table, package)
        dialog.destroy()
示例#35
0
 def show_next(self, button=None, tipe=None):
     """GUI callback Pops up the Event Manager"""
     self.dispatcher.emit("action-audio-disable-msg")
     text = {
         'title': _('Next Recordings'),
         'next_recs': self.get_next_recs(),
     }
     message.PopUp(message.NEXT_REC, text, context.get_mainwindow())
     self.dispatcher.emit("action-audio-enable-msg")
     return True
示例#36
0
 def show_next(self,button=None,tipe = None):
     """GUI callback Pops up the Event Manager"""
     self.dispatcher.emit("action-audio-disable-msg")
     text = {
             'title' : _('Next Recordings'),
             'next_recs' : self.get_next_recs(),
             }
     message.PopUp(message.NEXT_REC, text, context.get_mainwindow())
     self.dispatcher.emit("action-audio-enable-msg")
     return True
示例#37
0
def lock(element, text, show):
    message.PopUp(message.LOCKSCREEN,
                  text,
                  context.get_mainwindow(),
                  None,
                  response_action=on_unlock,
                  close_on_response=False,
                  show=show,
                  close_parent=True)
    logger.info("Galicaster locked")
示例#38
0
    def set_status_view(self):
        """Set the message and color of the status pilot on the top bar"""

        size = context.get_mainwindow().get_size()
        # k1 = size[0] / 1920.0
        k2 = size[1] / 1080.0

        l = gtk.ListStore(str,str,str)

        main_window = context.get_mainwindow()
        main_window.realize()
        style=main_window.get_style()

        bgcolor = style.bg[gtk.STATE_PRELIGHT]  
        fgcolor = style.fg[gtk.STATE_PRELIGHT]  

        for i in STATUS:
            if i[0] in ["Recording", "Error"]:
                l.append([_(i[0]), i[1], fgcolor])
            else:            
                l.append([_(i[0]), bgcolor, fgcolor])

        v = gtk.CellView()
        v.set_model(l)


        r = gtk.CellRendererText()
        self.renderer=r
        r.set_alignment(0.5,0.5)
        r.set_fixed_size(int(k2*400),-1)


        # k1 = size[0] / 1920.0
        k2 = size[1] / 1080.0
        font = pango.FontDescription("bold "+ str(int(k2*48)))
        r.set_property('font-desc', font)
        v.pack_start(r,True)
        v.add_attribute(r, "text", 0)
        v.add_attribute(r, "background", 1)   
        v.add_attribute(r, "foreground", 2)   
        v.set_displayed_row(0)
        return v
示例#39
0
 def info(self, key):
     """Pops up de MP info dialog"""
     logger.info("Info: {0}".format(str(key)))
     text = self.get_mp_info(key)
     text['title'] = 'Mediapackage Info'
     message.PopUp(message.MP_INFO,
                   text,
                   context.get_mainwindow(),
                   response_action=self.create_mp_info_response(
                       text['folder']),
                   close_on_response=False)
示例#40
0
    def on_help(self,button):
        """GUI callback to triggers a pop-up when Help button is clicked"""
        logger.info("Help requested")

        text = {"title" : _("Help"),
                "main" : _(self.help_main_str),
                "text" : _(self.help_text_str)
                }
        buttons = None
        message.PopUp(message.INFO, text,
                      context.get_mainwindow(), buttons)
示例#41
0
    def on_ask_stop(self, button):
        """Stops preview or recording and closes the Mediapakage"""
        if self.conf.get_boolean("basic", "stopdialog"):
            text = {"title": "Recorder", "main": "Are you sure you want to\nstop the recording?"}
            buttons = ("Stop", gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
            warning = message.PopUp(message.WARNING, text, context.get_mainwindow(), buttons)

            if warning.response not in message.POSITIVE:
                return False
            else:
                self.on_stop("UI", "current")
示例#42
0
    def on_help(self,button):
        """Triggers a pop-up when Help button is clicked"""
        logger.info("Help requested")   

        text = {"title" : _("Help"),
                "main" : _(" Visit galicaster.teltek.es"),
                "text" : _(" ...or contact us on our community list.")
		}
        buttons = None
        message.PopUp(message.INFO, text,
                      context.get_mainwindow(), buttons)
示例#43
0
    def on_help(self, button):
        """Triggers a pop-up when Help button is clicked"""
        logger.info("Help requested")

        text = {
            "title": "Help",
            "main": " Visit galicaster.teltek.es",
            "text": " ...or contact us on our community list."
        }
        buttons = None
        message.PopUp(message.INFO, text, context.get_mainwindow(), buttons)
示例#44
0
    def on_help(self, button):
        """GUI callback to triggers a pop-up when Help button is clicked"""
        logger.info("Help requested")

        text = {
            "title": _("Help"),
            "main": _(self.help_main_str),
            "text": _(self.help_text_str)
        }
        buttons = None
        message.PopUp(message.INFO, text, context.get_mainwindow(), buttons)
示例#45
0
def label_style(label, only_text=None, fsize=20):
    if not only_text:
        label.set_property("ypad", 10)
        label.set_property("xpad", 10)
        label.set_property("vexpand-set", True)
        label.set_property("vexpand", True)

    size = context.get_mainwindow().get_size()
    k1 = size[0] / 1920.0
    label.set_use_markup(True)
    label.modify_font(Pango.FontDescription(str(int(k1 * fsize))))
    return label
示例#46
0
 def launch_error_message(self, error_message):
     """Shows an active error message."""
     text = {
         "title": "Recorder",
         "main":
         " Please review your configuration \nor load another profile",
         "text": error_message
     }
     buttons = None
     logger.error("ERROR: " + error_message)
     self.error_dialog = message.PopUp(message.ERROR, text,
                                       context.get_mainwindow(), buttons)
示例#47
0
 def on_ask_stop(self, button):
     """Stops preview or recording and closes the Mediapakage"""
     self.dispatcher.emit("disable-no-audio")
     if self.conf.get_boolean("basic", "stopdialog"):
         text = {"title": _("Recorder"), "main": _("Are you sure you want to\nstop the recording?")}
         buttons = (gtk.STOCK_STOP, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
         warning = message.PopUp(message.WARNING, text, context.get_mainwindow(), buttons)
         self.dispatcher.emit("enable-no-audio")
         if warning.response not in message.POSITIVE or self.status not in [GC_RECORDING]:
             return False
         else:
             self.on_stop("UI", "current")
示例#48
0
def manage_button(element=None):
    recorder.enable_input()
    label = set_label(2,2,"Input status: ")
    label1 = set_label(0,1)
    context.get_mainwindow().insert_element(label,PAGES['REC'],"status_panel", "attach",left=0,top=4,width=1,height=1)
    context.get_mainwindow().insert_element(label1,PAGES['REC'],"status_panel", "attach", left=1,top=4,width=1,height=1)

    button = Gtk.ToggleButton()
    hbox = Gtk.Box()
    button.add(hbox)
    icon = Gtk.Image().new_from_icon_name("video-display",3)
    hbox.pack_start(icon,True,True,0)
    size = context.get_mainwindow().get_size()
    k1 = size[0] / 1920.0
    resize_button(button,size_image=k1*44,size_box=k1*46)

    to_disable = conf.get_list("muteinputs","bins")
    mute_type = conf.get_choice("muteinputs","mute_type", ["input", "preview"], "input")
    started_mute = conf.get_boolean("muteinputs","mute_on_startup")

    try:
        buttonREC = context.get_mainwindow().insert_element(button,PAGES['REC'],"buttonbox", "attach", left=6,top=0,width=1,height=1)
        buttonREC.connect("clicked",mute_inputs, mute_type, label1, to_disable)
    except Exception as exc:
        logger.error(exc)

    if started_mute:
        buttonREC.set_active(True)

    dispatcher.connect("recorder-ready", reload_mute, mute_type, label1, started_mute, button, to_disable)

    set_status_label(label1, mute_type)
示例#49
0
    def launch_error_message(self, error_msg=None):
        """Shows an active error message."""
        msg = error_msg or self.recorder.error_msg
        text = {
            "title" : _("Recorder"),
            "main" : _(" Please review your configuration \nor load another profile"),
            "text" : msg
                        }

        if self.error_dialog:
            self.destroy_error_dialog()
        self.error_dialog = message.PopUp(message.ERROR, text,
                                          context.get_mainwindow(), None, self.on_close_error_affirmative)
示例#50
0
 def on_ask_stop(self,button):
     """GUI callback for stops preview or recording and closes the Mediapakage"""
     if self.conf.get_boolean("basic", "stopdialog"):
         text = {"title" : _("Recorder"),
                 "main" : _("Are you sure you want to\nstop the recording?")}
         buttons = (Gtk.STOCK_STOP, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
         self.dispatcher.emit("disable-no-audio")
         warning = message.PopUp(message.WARN_STOP, text,
           context.get_mainwindow(), buttons)
         self.dispatcher.emit("enable-no-audio")
         if warning.response not in message.POSITIVE or self.recorder.status not in [RECORDING_STATUS]:
             return False
     self.recorder.stop()
示例#51
0
def quit():
    logger = context.get_logger()
    recorder = context.get_recorder()
    main_window = context.get_mainwindow()

    force = request.forms.get('force')

    if not recorder.is_recording() or readable.str2bool(force):
        logger.info("Quit Galicaster through API rest")

        GObject.idle_add(main_window.do_quit)
    else:
        abort(401, "Sorry, there is a current recording")
示例#52
0
    def on_help(self,button):
        """GUI callback to triggers a pop-up when Help button is clicked"""
        logger.info("Help requested")   

        text = {"title" : _("Help"),
                "main" : _(" Visit galicaster.teltek.es"),
                "text" : _(" ...or contact us on our community list.")
		}
        buttons = None
        self.dispatcher.emit("disable-no-audio")
        message.PopUp(message.INFO, text,
                      context.get_mainwindow(), buttons)
        self.dispatcher.emit("enable-no-audio")
示例#53
0
def warning_audio(element=None): # TODO make it generic
    global no_audio
    global no_audio_dialog
    global focus_is_active

    no_audio = True
    if focus_is_active and no_audio_dialog == None:
        gui = gtk.Builder()
        gui.add_from_file(get_ui_path('warning.glade'))
        no_audio_dialog = gui.get_object('dialog')
        no_audio_dialog.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        no_audio_dialog.set_transient_for(context.get_mainwindow().get_toplevel())
        no_audio_dialog.show() 
    return True
示例#54
0
    def __init__(self, parent=None, width = None, height=None):
        if not parent:
            parent = context.get_mainwindow()
        size = context.get_mainwindow().get_size()
        width = int(size[0]/2.2)
        height = int(size[1]/2.0)
        Gtk.Window.__init__(self, type=Gtk.WindowType.POPUP)
        self.set_transient_for(parent)
        self.set_destroy_with_parent(True)
        self.set_type_hint(Gdk.WindowTypeHint.TOOLBAR)
        self.set_title(_("Profile Selector"))
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_default_size(width,height)
        self.set_skip_taskbar_hint(True)
        self.set_modal(True)
        self.set_keep_above(False)
        self.parent = parent

        strip = Header(size=size,title=_("Profile Selector"))

        self.notebook = Gtk.Notebook()
        self.notebook.set_show_tabs(False)

        box = Gtk.VBox()
        box.pack_start(strip, False, False, int(0))
        strip.show()
        box.pack_start(self.notebook, True, True, 0)
        self.add(box)
        self.list=ListProfileBox(self, size)
        self.profile=None
        self.track=None

        tab1 = Gtk.Label(label=_("Profile Selector"))
        self.append_tab(self.list,tab1)
        parent.get_style_context().add_class('shaded')
        self.show_all()
        self.present()
 def delete(self,key, response=None):
     """Pops up a dialog. If response is positive, deletes a MP."""
     self.selected = key
     package = self.repository.get(key)
     logger.info("Delete: {0}".format(str(key)))
     t1 = _("This action will remove the recording from the hard disk.")
     t2 = _('Recording: "{0}"').format(package.getTitle())
     text = {"title" : _("Media Manager"),
             "main" : _("Are you sure you want to delete?"),
             "text" : t1+"\n\n"+t2
                 }
     buttons = ( Gtk.STOCK_DELETE, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
     message.PopUp(message.WARN_DELETE, text,
                   context.get_mainwindow(),
                   buttons, response)