def __init__(self, on_destroy=NO_OP): """Init.""" super(MagicicadaUI, self).__init__() self.sd = syncdaemon.SyncDaemon() if LAUNCHPAD_AVAILABLE: # for more information about LaunchpadIntegration: # wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding helpmenu = self.builder.get_object('helpMenu') if helpmenu: LaunchpadIntegration.set_sourcepackagename('magicicada') LaunchpadIntegration.add_items(helpmenu, 0, False, True) self._on_destroy = on_destroy active_filename = get_data_file('media', 'active-016.png') self.active_indicator = GdkPixbuf.Pixbuf.new_from_file(active_filename) self.status = Status(syncdaemon_instance=self.sd, xscale=1, yscale=1) self.main_box.pack_start(self.status, expand=False, fill=True, padding=6) self._icons = {} for size in (16, 32, 48, 64, 128): icon_filename = get_data_file('media', 'logo-%.3i.png' % size) self._icons[size] = GdkPixbuf.Pixbuf.new_from_file(icon_filename) self.main_window.set_default_icon_list(self._icons.values()) self.main_window.set_icon_list(self._icons.values()) self.indicator = Indicator(self) about_fname = get_data_file('media', 'logo-128.png') self.about_dialog.set_logo(GdkPixbuf.Pixbuf.new_from_file(about_fname)) self.operations = Operations(syncdaemon_instance=self.sd) self.main_box.pack_start(self.operations, expand=True, fill=True, padding=0) self.sd.status_changed_callback = self.on_status_changed self.sd.on_initial_data_ready_callback = self.on_initial_data_ready self.sd.on_initial_online_data_ready_callback = \ self.on_initial_online_data_ready
def __init__(self, main_ui): self.main_ui = main_ui category = AppIndicator3.IndicatorCategory.APPLICATION_STATUS icon_name = "icon-idle-16" logos_path = os.path.join(get_data_file(), 'media') ind = AppIndicator3.Indicator.new("magicicada", icon_name, category) ind.set_status(AppIndicator3.IndicatorStatus.ACTIVE) ind.set_title("Magicicada") ind.set_icon_theme_path(logos_path) ind.set_icon(icon_name) self.indicator = ind self.menu = None self.set_menu()