Example #1
0
    def check_net(self, origin, status=None):
        """Update the value of the network status"""

        network_css_ids = {
            'Disabled'  : 'gray_coloured',
            'Up'        : 'green_coloured',
            'Down'      : 'red_coloured',
            'Connecting': 'orange_coloured',
        }
        s3 = self.gui.get_object("status3")
        if not self.net_activity:
            s3.set_text(_("Disabled"))
            s3.set_name(network_css_ids['Disabled'])
        else:
            try:
                if status == True:
                    s3.set_text(_("Up"))
                    s3.set_name(network_css_ids['Up'])
                elif status == False:
                    s3.set_text(_("Down"))
                    s3.set_name(network_css_ids['Down'])
                else:
                    s3.set_text(_("Connecting..."))
                    s3.set_name(network_css_ids['Connecting'])
            except KeyError:
                s3.set_text(_("Connecting"))
                s3.set_name(network_css_ids['Connecting'])
Example #2
0
    def __init__(self, profile=None, device=None, parent=None):
        """Edit manager for track of device in a profile"""
        self.superior = parent
        gtk.HBox.__init__(self, False, 5)
        self.set_border_width(20)
        self.profile = profile
        self.device = device

        self.buttons = gtk.VButtonBox()
        self.buttons.set_layout(gtk.BUTTONBOX_START)
        self.buttons.set_spacing(5)

        self.add_button(_("Save"), self.retrieve_data)
        #self.add_button("Test", self.test_track, True)
        self.add_button(_("Cancel"), self.close, True)

        self.table = None
        self.model = None

        if device.device:
            self.table, self.model, self.combo = self.prepare_device(device)
            self.combo.connect("changed", self.show_options)
        else:
            self.table, self.model, self.combo = self.prepare_empty_device()
            self.combo.connect("changed", self.show_options)

        self.table.attach(self.combo, 1, 2, 0, 1, 0, 0)
        self.pack_start(self.table, True, True, 0)
        self.pack_start(self.buttons, False, False, 20)
        self.show_all()
Example #3
0
    def check_net(self, origin, status=None):
        """Update the value of the network status"""

        network_css_ids = {
            'Disabled': 'gray_coloured',
            'Up': 'green_coloured',
            'Down': 'red_coloured',
            'Connecting': 'orange_coloured',
        }
        s3 = self.gui.get_object("status3")
        if not self.net_activity:
            s3.set_text(_("Disabled"))
            s3.set_name(network_css_ids['Disabled'])
        else:
            try:
                if status == True:
                    s3.set_text(_("Up"))
                    s3.set_name(network_css_ids['Up'])
                elif status == False:
                    s3.set_text(_("Down"))
                    s3.set_name(network_css_ids['Down'])
                else:
                    s3.set_text(_("Connecting..."))
                    s3.set_name(network_css_ids['Connecting'])
            except KeyError:
                s3.set_text(_("Connecting"))
                s3.set_name(network_css_ids['Connecting'])
Example #4
0
def show_msg(element=None):
    buttonDIS = show_buttons(PAGES['DIS'])
    buttonREC = show_buttons(PAGES['REC'])
    buttonMMA = show_buttons(PAGES['MMA'])

    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 buttonDIS is not None:
        buttonDIS.connect("clicked", lock, text, show)
    if buttonREC is not None:
        buttonREC.connect("clicked", lock, text, show)
    if buttonMMA is not None:
        buttonMMA.connect("clicked", lock, text, show)

    lock(None, text, show)
Example #5
0
    def __init__(self, profile=None, device=None, parent=None):
        """Edit manager for track of device in a profile"""
        self.superior = parent
        #GObject.__init__(self, False, 5)
        GObject.GObject.__init__(self)
        self.set_border_width(20)
        self.profile = profile
        self.device = device

        self.buttons = Gtk.VButtonBox()
        self.buttons.set_layout(Gtk.ButtonBoxStyle.START)
        self.buttons.set_spacing(5)

        self.add_button(_("Save"), self.retrieve_data)
        #self.add_button("Test", self.test_track, True)
        self.add_button(_("Cancel"), self.close, True)

        self.table = None
        self.model = None

        if device.device:
            self.table,self.model,self.combo = self.prepare_device(device)
            self.combo.connect("changed",self.show_options)
        else:
            self.table,self.model,self.combo = self.prepare_empty_device()
            self.combo.connect("changed",self.show_options)

        self.table.attach(self.combo,1,2,0,1,0,0)
        self.pack_start(self.table,True,True,0)
        self.pack_start(self.buttons,False,False,20)
        self.show_all()
Example #6
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)
Example #7
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)
Example #8
0
    def shutdown(self, signal):
        """Pops up a dialog asking to shutdown the computer"""
        text = {"title": _("Shutdwon"),
                "main": _("Are you sure you want to SHUTDOWN? "),
                }

        buttons = (Gtk.STOCK_QUIT, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
        message.PopUp(message.WARN_QUIT, text, self, buttons, self.on_shutdown_dialog_response)
Example #9
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)
Example #10
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)
Example #11
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)
Example #12
0
    def update_scheduler_timeout(self, status, event_type, title, attr_red, attr_black, changed, parpadeo):
        """GObject.timeout callback with 500 ms intervals"""
        if self.recorder.current_mediapackage and not self.recorder.current_mediapackage.manual:
            start = self.recorder.current_mediapackage.getLocalDate()
            duration = self.recorder.current_mediapackage.getDuration() / 1000
            end = start + datetime.timedelta(seconds=duration)
            dif = end - datetime.datetime.now()
            status.set_text(_("Stopping in {0}").format(readable.long_time(dif)))
            event_type.set_text(CURRENT_TEXT) 
            title.set_text(self.recorder.current_mediapackage.title)             
                
            if dif < datetime.timedelta(0, TIME_RED_STOP):
                if not changed:
                    status.set_attributes(attr_red)
                    changed = True
            elif changed:
                status.set_attributes(attr_black)
                changed = False
            if dif < datetime.timedelta(0,TIME_BLINK_STOP):
                parpadeo = not parpadeo

        else:
            next_mediapackage = self.repo.get_next_mediapackage()
            if next_mediapackage:
                start = next_mediapackage.getLocalDate()
                dif = start - datetime.datetime.now()
                if event_type.get_text != NEXT_TEXT:
                    event_type.set_text(NEXT_TEXT)
                if title.get_text() != next_mediapackage.title:
                    title.set_text(next_mediapackage.title)
                status.set_text(_("Starting in {0}").format(readable.long_time(dif)))

                if dif < datetime.timedelta(0,TIME_RED_START):
                    if not changed:
                        status.set_attributes(attr_red)
                        changed = True
                elif changed:
                    status.set_attributes(attr_black)
                    changed = False

                if dif < datetime.timedelta(0,TIME_BLINK_START):
                    if parpadeo:
                        status.set_text("")
                        parpadeo =  False
                    else:
                        parpadeo = True

            else: # Not current or pending recordings
                if event_type.get_text():                
                    event_type.set_text("")
                if status.get_text():
                    status.set_text("")
                if title.get_text() != _("No upcoming events"):
                    title.set_text(_("No upcoming events"))

        return True
Example #13
0
 def recording_info_timeout(self, rec_title, rec_elapsed):
     """GObject.timeout callback with 500 ms intervals"""
     if self.recorder.status in [PAUSED_STATUS, RECORDING_STATUS]:
         rec_title.set_text(self.recorder.current_mediapackage.getTitle())
         msec = datetime.timedelta(microseconds=(round(self.recorder.get_recorded_time()/1000.0,-6)))
         rec_elapsed.set_text(_("Elapsed Time: ") + readable.long_time(msec))
         return True
     rec_title.set_text(_("Not recording"))
     rec_elapsed.set_text("")
     return False
    def __init__(self, parent, size, tester = False):
        ProfileDialog.__init__(self, parent, size)

        self.add_button(_("Select"),self.change_selected_profile)
        self.add_button(_("Close"),self.close, True)

        self.append_profiles()
        self.select_current_profile()
        self.append_info(self.view.get_selection())
        self.show_all()
Example #15
0
    def __init__(self, parent, size, tester=False):
        ProfileDialog.__init__(self, parent, size)

        self.add_button(_("Select"), self.change_selected_profile)
        self.add_button(_("Close"), self.close, True)

        self.append_profiles()
        self.select_current_profile()
        self.append_info(self.view.get_selection())
        self.show_all()
Example #16
0
    def close(self, signal):
        """Pops up a dialog asking to quit"""
        text = {"title": _("Quit"),
                "main": _("Are you sure you want to QUIT? "),
                }

        buttons = (Gtk.STOCK_QUIT, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
        self.dispatcher.emit("action-audio-disable-msg")
        message.PopUp(message.WARN_QUIT, text,
                      self, buttons, self.on_close_dialog_response)
        self.dispatcher.emit("action-audio-enable-msg")
Example #17
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)
Example #18
0
    def shutdown(self, signal):
        """Pops up a dialog asking to shutdown the computer"""
        text = {
            "title": _("Shutdwon"),
            "main": _("Are you sure you want to SHUTDOWN? "),
        }

        buttons = (Gtk.STOCK_QUIT, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL,
                   Gtk.ResponseType.REJECT)
        message.PopUp(message.WARN_QUIT, text, self, buttons,
                      self.on_shutdown_dialog_response)
Example #19
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)
Example #20
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)
Example #21
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)
Example #22
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()
Example #23
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")
Example #24
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)
Example #25
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)
Example #26
0
 def recording_info_timeout(self, rec_title, rec_elapsed):
     """GObject.timeout callback with 500 ms intervals"""
     if self.recorder.status in [PAUSED_STATUS, RECORDING_STATUS]:
         rec_title.set_text(self.recorder.current_mediapackage.getTitle())
         msec = datetime.timedelta(
             microseconds=(round(self.recorder.get_recorded_time() /
                                 1000.0, -6)))
         rec_elapsed.set_text(
             _("Elapsed Time: ") + readable.long_time(msec))
         return True
     rec_title.set_text(_("Not recording"))
     rec_elapsed.set_text("")
     return False
Example #27
0
    def fill_menu(self):
        """Fill the menu to be shown on right-button-click over a MP"""
        operations = [(_("Play"), "play_action"), (_("Edit"), "edit_action"),
                      (_("Info"), "info_action"),
                      (_("Operations"), "operations_action"),
                      (_("Delete"), "delete_action")]

        for op in operations:
            item = Gtk.MenuItem.new_with_label(op[0])
            item.set_name(op[1])
            self.menu.append(item)
            item.connect("activate", self.on_action)
            item.show()
Example #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)
         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()
Example #29
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")
Example #30
0
    def close(self, signal):
        """Pops up a dialog asking to quit"""
        text = {
            "title": _("Quit"),
            "main": _("Are you sure you want to QUIT? "),
        }

        buttons = (Gtk.STOCK_QUIT, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL,
                   Gtk.ResponseType.REJECT)
        self.dispatcher.emit("action-audio-disable-msg")
        message.PopUp(message.WARN_QUIT, text, self, buttons,
                      self.on_close_dialog_response)
        self.dispatcher.emit("action-audio-enable-msg")
Example #31
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()
        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()
Example #32
0
    def fill_menu(self):
        """Fill the menu to be shown on right-button-click over a MP"""
        operations = [ (_("Play"), "play_action"),
                (_("Edit"), "edit_action"),
                (_("Info"), "info_action"),
                (_("Operations"), "operations_action"),
                (_("Delete"), "delete_action")]

        for op in operations:
            item = Gtk.MenuItem.new_with_label(op[0])
            item.set_name(op[1])
            self.menu.append(item)
            item.connect("activate", self.on_action)
            item.show()
Example #33
0
    def check_status_area(self, origin, signal=None, other=None):
        """Updates the values on the recording tab"""
        s1 = self.gui.get_object("status1")
        s2 = self.gui.get_object("status2")
        s4 = self.gui.get_object("status4")

        freespace = self.repo.get_free_space()
        text_space = readable.size(freespace)

        four_gb = 4000000000.0
        hours = int(freespace / four_gb)
        s1.set_text(_("{0} ({1} hours left)").format(text_space, str(hours)))
        s2.set_text(_("Idle"))
        agent = self.conf.get_hostname()  # TODO just consult it once
        s4.set_text(agent)
 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)
Example #35
0
    def check_status_area(self, origin, signal=None, other=None):
        """Updates the values on the recording tab"""
        s1 = self.gui.get_object("status1")
        s2 = self.gui.get_object("status2")
        s4 = self.gui.get_object("status4")

        freespace = self.repo.get_free_space()
        text_space = readable.size(freespace)

        four_gb = 4000000000.0
        hours = int(freespace/four_gb)
        s1.set_text(_("{0} ({1} hours left)").format(text_space, str(hours)))
        s2.set_text(_("Idle"))
        agent = self.conf.get_hostname() # TODO just consult it once
        s4.set_text(agent)
Example #36
0
    def timer_launch_thread(self):
        """Thread handling the recording elapsed time timer."""
        
        # Based on: http://pygstdocs.berlios.de/pygst-tutorial/seeking.html
        
        thread_id= self.timer_thread_id
        self.initial_time=self.recorder.get_time()
        self.initial_datetime=datetime.datetime.utcnow().replace(microsecond = 0)
        gtk.gdk.threads_enter()
        self.statusbar.SetTimer(0)
        gtk.gdk.threads_leave()
        self.paused_time = datetime.timedelta(0,0)

        rec_title = self.gui.get_object("recording1")
        rec_elapsed = self.gui.get_object("recording3")
              
        while thread_id == self.timer_thread_id:            
        #while True:
            actual_time=self.recorder.get_time()               
            timer=(actual_time-self.initial_time)/gst.SECOND
            if self.status==GC_PAUSED:
                self.paused_time = self.paused_time + datetime.timedelta(0,0,200000)               
            dif = datetime.datetime.utcnow() - self.initial_datetime - self.paused_time

            if thread_id==self.timer_thread_id:
                gtk.gdk.threads_enter()
                self.statusbar.SetTimer(timer)
                if rec_title.get_text() != self.mediapackage.getTitle():
                    rec_title.set_text(self.mediapackage.getTitle())
                rec_elapsed.set_text(_("Elapsed Time: ") + self.time_readable(dif))
                gtk.gdk.threads_leave()
            time.sleep(0.2)          
        return True
Example #37
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")
Example #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

        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
Example #39
0
    def shutdown(self, signal):
        """Pops up a dialog asking to shutdown the computer"""
        text = {"title": _("Shutdwon"), "main": _("Are you sure you want to SHUTDOWN? ")}

        buttons = (gtk.STOCK_QUIT, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
        warning = message.PopUp(message.WARNING, text, self, buttons)

        if warning.response in message.POSITIVE:
            if self.logger:
                self.logger.info("Shutdown Galicaster")
            if self.dispatcher:
                self.dispatcher.emit("galicaster-notify-quit")
            UtilsShutdown()
        else:
            if self.logger:
                self.logger.info("Cancel Shutdown")
Example #40
0
 def new_track(self, origin):
     """Creates a new track on a given profile and pops up the editor"""
     new = conf.Track()
     tab3 = gtk.Label(self.superior.get_title() + " > " + _("New Track"))
     self.superior.track = TrackBox(self.profile, new, self.superior)
     self.superior.append_tab(self.superior.track, tab3)
     return new
Example #41
0
    def fill_mp_info(self, gui, info):
        """ Fill next recordings PopUp grid with the MP information
        """
        # FIXME: Merge fill info and fill mp info in any way?
        # Make a generic function in order to fill grids with dynamic widgets information
        grid = gui.get_object('mp_grid')
        row = 1
        for mp in info:
            column = 0
            for label, content in mp.iteritems():
                widget = gui.get_object('{}_mp'.format(label))
                if widget:
                    if isinstance(widget, Gtk.Label):
                        new_widget = Gtk.Label().new(content)
                    else:
                        new_widget = Gtk.Button().new_with_label(
                            _("Record Now"))
                        # FIXME: Use set_properties?
                        new_widget.set_property('halign',
                                                widget.get_property('halign'))
                        new_widget.set_property('valign',
                                                widget.get_property('valign'))
                        new_widget.connect("clicked", self.send_start, content)
                        recorder = context.get_recorder()
                        if recorder.status == ERROR_STATUS:
                            new_widget.set_sensitive(False)
                    widget_classes = widget.get_style_context().list_classes()
                    for style_class in widget_classes:
                        widget_style_context = new_widget.get_style_context()
                        widget_style_context.add_class(style_class)
                    new_widget.show()

                grid.attach(new_widget, column, row, 1, 1)
                column += 1
            row += 1
    def fill_mp_info(self, gui, info):
        """ Fill next recordings PopUp grid with the MP information
        """
        # FIXME: Merge fill info and fill mp info in any way?
        # Make a generic function in order to fill grids with dynamic widgets information
        grid = gui.get_object('mp_grid')
        row = 1
        for mp in info:
            column = 0
            for label, content in mp.iteritems():
                widget = gui.get_object('{}_mp'.format(label))
                if widget:
                    if isinstance(widget, Gtk.Label):
                        new_widget = Gtk.Label().new(content)
                    else:
                        new_widget = Gtk.Button().new_with_label(_("Record Now"))
                        # FIXME: Use set_properties?
                        new_widget.set_property('halign', widget.get_property('halign'))
                        new_widget.set_property('valign', widget.get_property('valign'))
                        new_widget.connect("clicked", self.send_start, content)
                        recorder = context.get_recorder()
                        if recorder.status == ERROR_STATUS:
                            new_widget.set_sensitive(False)
                    widget_classes = widget.get_style_context().list_classes()
                    for style_class in widget_classes:
                        widget_style_context = new_widget.get_style_context()
                        widget_style_context.add_class(style_class)
                    new_widget.show()

                grid.attach(new_widget, column, row, 1, 1)
                column += 1
            row += 1
Example #43
0
 def new_track(self, origin):
     """Creates a new track on a given profile and pops up the editor"""
     new=conf.Track()
     tab3=Gtk.Label(label=self.superior.get_title()+" > "+_("New Track"))
     self.superior.track=TrackBox(self.profile,new, self.superior)
     self.superior.append_tab(self.superior.track,tab3)
     return new
Example #44
0
 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)
Example #45
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
Example #46
0
    def __init__(self, dispatcher=None, size=None, logger=None):
        Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL)
        self.logger = logger

        self.full_size = self.discover_size()  # Fullscreen size
        self.custom_size = self.full_size
        expr = '[0-9]+[\,x\:][0-9]+'  # Parse custom size
        if re.match(expr, size):
            self.custom_size = [
                int(a) for a in size.split(re.search('[,x:]', size).group())
            ]
        elif size == "auto":
            self.logger.info("Default resolution and fullscreen: " +
                             str(self.full_size))
        else:
            self.logger.warning(
                "Invalid resolution, set default. Should be 'width,height'. " +
                size)

        if self.custom_size[0] > self.full_size[0]:
            self.custom_size[0] = self.full_size[0]
            self.logger.warning(
                "Resolution Width is bigger than the monitor, set to monitor maximum"
            )

        if self.custom_size[1] > self.full_size[1]:
            self.custom_size[1] = self.full_size[1]
            self.logger.warning(
                "Resolution height is bigger than the monitor, set to monitor maximum"
            )

        self.__def_win_size__ = (self.custom_size[0], self.custom_size[1])
        self.set_size_request(self.custom_size[0], self.custom_size[1])
        #        self.resize(self.custom_size[0],self.custom_size[1])

        self.set_title(_("GaliCASTER {0}").format(__version__))
        self.set_decorated(False)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.is_fullscreen = (self.custom_size == self.full_size)

        self.set_style()
        self.set_width_interval_class(self.get_size()[0])

        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            get_image_path('galicaster.svg'), 48, 48)
        pixbuf = pixbuf.scale_simple(128, 128, GdkPixbuf.InterpType.BILINEAR)
        self.set_icon(pixbuf)
        self.connect('delete_event', lambda *x: self.__on_delete_event())
        self.dispatcher = dispatcher
        self.connect('visibility-notify-event', self.on_visibility_event)
        if self.dispatcher:
            self.dispatcher.connect('action-quit', self.close)
            self.dispatcher.connect('action-shutdown', self.shutdown)

        self.nbox = Gtk.Notebook()
        self.nbox.set_show_tabs(False)
        self.add(self.nbox)

        self.connect('key-press-event', self.on_key_press)
        self.connect('key-release-event', self.on_key_release)
Example #47
0
    def on_play(self,store,reference,iterator):
        """ Retrieve mediapackage and send videos to player"""
	key = store[iterator][0]
	logger.info("Play: " + str(key))
	package = self.repository.get(key)

	if package.status == mediapackage.RECORDED:
	    self.dispatcher.emit("play-list", package)
	else:			
	    text = {"title" : _("Media Manager"),
		    "main" : _("This recording can't be played"),
		   }
	    buttons = ( gtk.STOCK_OK, gtk.RESPONSE_OK )
	    message.PopUp(message.WARNING, text, 
                          context.get_mainwindow(),
                          buttons)
	return True	
Example #48
0
    def on_play(self, store, reference, iterator):
        """ Retrieve mediapackage and send videos to player"""
        key = store[iterator][0]
        logger.info("Play: " + str(key))
        package = self.repository.get(key)

        if package.status == mediapackage.RECORDED:
            self.dispatcher.emit("play-list", package)
        else:
            text = {
                "title": _("Media Manager"),
                "main": _("This recording can't be played"),
            }
            buttons = (gtk.STOCK_OK, gtk.RESPONSE_OK)
            message.PopUp(message.WARNING, text, context.get_mainwindow(),
                          buttons)
        return True
 def button_clear_user(self, button):
     self.__logger.info("CLEAR USER")
     self.details = None
     self.btn_clear.set_sensitive(False)  # disabled
     self.btn_show.set_label("Select a user...")
     self.title.set_text(_("No upcoming events"))
     self.box.show_all()
     recorder.title_standin = None
Example #50
0
    def close(self, signal):
        """Pops up a dialog asking to quit"""
        text = {"title": _("Quit"), "main": _("Are you sure you want to QUIT? ")}

        buttons = (gtk.STOCK_QUIT, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
        self.dispatcher.emit("disable-no-audio")
        warning = message.PopUp(message.WARNING, text, self, buttons)
        self.dispatcher.emit("enable-no-audio")

        if warning.response in message.POSITIVE:
            if self.logger:
                self.logger.info("Quit Galicaster")
            if self.dispatcher:
                self.dispatcher.emit("galicaster-notify-quit")
            gtk.main_quit()
        else:
            if self.logger:
                self.logger.info("Cancel Quit")
Example #51
0
    def __init__(self, profile, parent):
        """
        Fills the Track tab with the track data of a profile
        """
        ProfileDialog.__init__(self, parent)
        self.profile = profile
        self.add_button(_("Save"), self.save_profile)
        self.add_button(_("Edit"), self.edit_track)
        self.add_button(_("New track"), self.new_track)
        self.add_button(_("Delete track"), self.delete_track)
        self.add_button(_("Cancel"), self.close, True)

        self.append_tracks(profile)
        self.profile_name = gtk.Entry()
        self.profile_name.set_text(profile.name)
        self.vbox.pack_start(self.profile_name, False, False, 10)

        self.show_all()
Example #52
0
    def __init__(self, profile, parent):
        """
        Fills the Track tab with the track data of a profile
        """
        ProfileDialog.__init__(self, parent)
        self.profile = profile
        self.add_button(_("Save"), self.save_profile)
        self.add_button(_("Edit"), self.edit_track)
        self.add_button(_("New track"), self.new_track)
        self.add_button(_("Delete track"),self.delete_track)
        self.add_button(_("Cancel"), self.close, True)

        self.append_tracks(profile)
        self.profile_name = Gtk.Entry()
        self.profile_name.set_text(profile.name)
        self.vbox.pack_start(self.profile_name,False,False,10)

        self.show_all()
Example #53
0
def on_rec(button):
    global dispatcher, recorder, recorder_ui, metadata
    dispatcher.emit("action-audio-disable-msg")
    mp = None

    if not recorder.current_mediapackage:
        mp = recorder.create_mp()

    if not mp:
        mp = recorder.current_mediapackage

    # Add default metadata to the MP
    mp.metadata_episode.update(metadata)

    ocservice = context.get_ocservice()
    series_list = []
    if ocservice:
        series_list = ocservice.series

    # Check the series
    try:
        del (mp.metadata_episode['isPartOf'])
        mp.metadata_series = utils_series.filterSeriesbyId(
            series_list, metadata['isPartOf'])['list']
    except (TypeError, KeyError):
        # There was no series specified, so no change was needed
        pass

    arguments = {
        'package': mp,
        #'series_list': series_list,
        'title': _("New Recording"),
        'subtitle': _("New Recording"),
        'ok_label': _("Start"),
    }

    if len(series_list) <= 1:
        arguments['empty_series_label'] = None

    popup = MetadataClass(**arguments)

    if popup.return_value == -8:
        recorder_ui.on_rec(button=None)
    dispatcher.emit("action-audio-enable-msg")
Example #54
0
    def get_mp_info(self, key):
        """ Retrieves a dictionary with the information of the MP
        with the given key

        Args:
            key (str): the MP identifier

        Returns:
            Dict {}: with the label of the info.glade dialog as key
                    and the content of the label as values.
        """
        mp = self.repository.get(key)

        data = set_manifest_json(mp)

        # General
        data['title_mp'] = data['title']
        del data['title']

        data['duration'] = readable.time((data['duration']) / 1000)
        data['size'] = readable.size(data['size'])
        data['created'] = readable.date(mp.getStartDateAsString(),
                                        "%B %d, %Y - %H:%M").replace(
                                            ' 0', ' ')

        if data.has_key('seriestitle'):
            data['isPartOf'] = data['seriestitle']

        # Operations
        for op, status in data['operations'].iteritems():
            data[op] = mediapackage.op_status[status]
        del data['operations']

        # Tracks
        tracks = []
        for track in data['media']['track']:
            t = {}
            t[_('Name:')] = track['id']
            t[_('Type:')] = track['mimetype']
            t[_('Flavor:')] = track['type']
            t[_('File:')] = path.split(track['url'])[1]
            tracks.append(t)
        if tracks:
            data['tracks'] = tracks
            del data['media']

        # Catalogs
        catalogs = []
        for catalog in data['metadata']['catalog']:
            c = {}
            c[_('Name:')] = catalog['id']
            c[_('Flavor:')] = catalog['type']
            c[_('Type:')] = catalog['mimetype']
            catalogs.append(c)
        if catalogs:
            data['catalogs'] = catalogs
            del data['metadata']

        return data
Example #55
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
Example #56
0
    def shutdown(self, signal):
        """Pops up a dialog asking to shutdown the computer"""
        text = {"title" : _("Shutdwon"),
                "main" : _("Are you sure you want to SHUTDOWN? "), 
                }

        buttons = ( gtk.STOCK_QUIT, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
        warning = message.PopUp(message.WARNING, text,
                                self, buttons)

        if warning.response in message.POSITIVE:
            if self.logger:
                self.logger.info("Shutdown Galicaster")
            if self.dispatcher:
                self.dispatcher.emit('galicaster-notify-quit')
            UtilsShutdown()
        else:
            if self.logger:
                self.logger.info("Cancel Shutdown")
Example #57
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
    def get_mp_info(self,key):
        """ Retrieves a dictionary with the information of the MP
        with the given key

        Args:
            key (str): the MP identifier

        Returns:
            Dict {}: with the label of the info.glade dialog as key
                    and the content of the label as values.
        """
        mp = self.repository.get(key)

        data = set_manifest_json(mp)

        # General
        data['title_mp'] = data['title']
        del data['title']

        data['duration'] = readable.time((data['duration'])/1000)
        data['size'] = readable.size(data['size'])
        data['created'] = readable.date(mp.getStartDateAsString(),
                                   "%B %d, %Y - %H:%M").replace(' 0',' ')

        if data.has_key('seriestitle'):
            data['isPartOf'] = data['seriestitle']

        # Operations
        for op,status in data['operations'].iteritems():
            data[op] = mediapackage.op_status[status]
        del data['operations']

        # Tracks
        tracks = []
        for track in data['media']['track']:
            t = {}
            t[_('Name:')] = track['id']
            t[_('Type:')] = track['mimetype']
            t[_('Flavor:')] = track['type']
            t[_('File:')] = path.split(track['url'])[1]
            tracks.append(t)
        if tracks:
            data['tracks'] = tracks
            del data['media']

        # Catalogs
        catalogs = []
        for catalog in data['metadata']['catalog']:
            c = {}
            c[_('Name:')] = catalog['id']
            c[_('Flavor:')] = catalog['type']
            c[_('Type:')] = catalog['mimetype']
            catalogs.append(c)
        if catalogs:
            data['catalogs'] = catalogs
            del data['metadata']

        return data
Example #59
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