def create(window, APP_PATH, service): global grid_appid, entrybox_appid Load_Config() ui = Gtk.Builder() ui.add_from_file(os.path.join(APP_PATH, "dialogs", "city_id_dialog.ui")) dialog = ui.get_object('dialog1') dialog.set_icon_from_file(os.path.join(APP_PATH, "icon.png")) list_o = ui.get_objects() dict_o = {} dict_o = localization.translate_ui(list_o, dict_o) dialog.set_title(_('Location')) dialog.set_default_size(100, 400) liststore2 = ui.get_object('liststore2') combobox_weather_lang = ui.get_object('combobox_weather_lang') combobox_weather_lang.connect("changed", set_weather_lang) combobox_service = ui.get_object('combobox_service') liststore3 = ui.get_object('liststore3') label = ui.get_object('label1') for i in range(len(services_list)): liststore3.append([services_list[i]]) combobox_service.set_active(data.get_index(service)) store = ui.get_object('liststore1') grid_appid = ui.get_object('grid_appid') entrybox_appid = ui.get_object('entrybox_appid') load_data(service, label, liststore2, combobox_weather_lang, gw_config['weather_lang'], store) combobox_service.connect("changed", set_service, label, liststore2, combobox_weather_lang, gw_config['weather_lang'], store) entrybox = ui.get_object('entrybox') bar_ok = ui.get_object('bar_ok') bar_err = ui.get_object('bar_err') bar_label = ui.get_object('bar_label') treeView = ui.get_object('treeView') create_columns(treeView) return dialog, entrybox, treeView, bar_err, bar_ok, bar_label, combobox_weather_lang, weather_lang_list, combobox_service, grid_appid, entrybox_appid
def create(window, APP_PATH, service): global grid_appid, entrybox_appid Load_Config() ui = Gtk.Builder() ui.add_from_file(os.path.join(APP_PATH, "dialogs","city_id_dialog.ui")) dialog = ui.get_object('dialog1') dialog.set_icon_from_file(os.path.join(APP_PATH, "icon.png")) list_o = ui.get_objects() dict_o = {} dict_o = localization.translate_ui(list_o, dict_o) dialog.set_title(_('Location')) dialog.set_default_size(100, 400) liststore2 = ui.get_object('liststore2') combobox_weather_lang = ui.get_object('combobox_weather_lang') combobox_weather_lang.connect("changed", set_weather_lang) combobox_service = ui.get_object('combobox_service') liststore3 = ui.get_object('liststore3') label = ui.get_object('label1') for i in range(len(services_list)): liststore3.append([services_list[i]]) combobox_service.set_active(data.get_index(service)) store = ui.get_object('liststore1') grid_appid = ui.get_object('grid_appid') entrybox_appid = ui.get_object('entrybox_appid') load_data(service, label, liststore2, combobox_weather_lang, gw_config['weather_lang'], store) combobox_service.connect("changed", set_service, label, liststore2, combobox_weather_lang, gw_config['weather_lang'], store) entrybox = ui.get_object('entrybox') bar_ok = ui.get_object('bar_ok') bar_err = ui.get_object('bar_err') bar_label = ui.get_object('bar_label') treeView = ui.get_object('treeView') create_columns(treeView) return dialog, entrybox, treeView, bar_err, bar_ok, bar_label, combobox_weather_lang, weather_lang_list, combobox_service, grid_appid, entrybox_appid
def load_config_into_form(self): global state_lock state_lock = True if INSTANCE_NO < 2: self.frame_autostart2.hide() else: self.frame_autostart1.hide() wind_units_list = [_('m/s'), _('km/h'), _('mph'), _('Beaufort scale'), _('Knots')] press_units_list = [_('mmHg'), _('inHg'), _('hPa')] self.liststore1.clear() self.liststore1.append([_('Never')]) self.liststore1.append([_('Only at start')]) self.liststore1.append([_('Always')]) self.liststore2.clear() self.liststore2.append([_('No')]) self.liststore2.append([_('Only background')]) self.liststore2.append([_('Yes')]) self.liststore7.clear() self.liststore7.append(['°C']) self.liststore7.append(['°F']) self.liststore7.append(['K']) self.liststore11.clear() self.liststore11.append(['Widget only']) self.liststore11.append(['Indicator only']) self.liststore11.append(['Widget + Indicator']) self.liststore12.clear() self.liststore12.append(['Gtk.StatusIcon']) self.liststore12.append(['AppIndicator3']) self.liststore9.clear() for i in wind_units_list: self.liststore9.append([i]) self.liststore10.clear() for i in press_units_list: self.liststore10.append([i]) self.liststore8.clear() for i in range(len(services_list)): self.liststore8.append([services_list[i]]) self.combobox_service.set_active(data.get_index(service_set)) self.liststore15.clear() for i in range(len(date_separators_list)): self.liststore15.append([date_separators[date_separators_list[i]]]) if gw_config_set['date_separator'] == date_separators_list[i]: self.combobox_date_separator.set_active(i) self.load(self.combobox_wind_units) self.load(self.combobox_press_units) self.load(self.spinbutton_upd_time) self.load(self.switch_t_feel) self.load(self.switch_fix_BadDrawable) self.load(self.spinbutton_x_pos) self.load(self.spinbutton_y_pos) self.load(self.spinbutton_margin) self.load(self.spinbutton_opacity) self.load(self.switch_fix_position) self.load(self.switch_sticky) self.load(self.spinbutton_block_today_left) self.load(self.switch_show_block_today) self.load(self.spinbutton_block_tomorrow_left) self.load(self.switch_show_block_tomorrow) self.load(self.spinbutton_block_wind_direct_left) self.load(self.switch_show_block_wind_direct) self.load(self.spinbutton_angel) self.load(self.switch_wind_direct_small) self.load(self.spinbutton_block_add_info_left) self.load(self.switch_show_block_add_info) self.load(self.spinbutton_n) self.load(self.switch_show_time_receive) self.load(self.switch_show_chance_of_rain) self.load(self.combobox_check_for_updates) self.load(self.combobox_show_splash_screen) self.load(self.combobox_t_scale) self.load(self.spinbutton_max_try_show) self.fontbutton_font.set_font_name(gw_config_set['font']) self.load(self.colorbutton_color_text) self.load(self.colorbutton_color_text_week) self.load(self.colorbutton_color_shadow) self.load(self.colorbutton_color_high_wind) self.load(self.colorbutton_color_bg) self.load(self.switch_draw_shadow) self.load(self.spinbutton_high_wind) self.load(self.switch_show_bg_png) self.load(self.spinbutton_r) self.load(self.spinbutton_delay_start_time) self.load(self.spinbutton_block_now_left) self.load(self.combobox_show_indicator) self.load(self.combobox_indicator_is_appindicator) self.load(self.switch_indicator_draw_shadow) self.fontbutton_indicator_font.set_font_name(gw_config_set['indicator_font']+' '+str(gw_config_set['indicator_font_size'])) self.load(self.colorbutton_indicator_color_text) self.load(self.colorbutton_indicator_color_shadow) self.load(self.spinbutton_indicator_top) self.load(self.spinbutton_indicator_width) self.load(self.spinbutton_scale) self.load(self.spinbutton_app_indicator_size) self.load(self.switch_app_indicator_fix_size) self.load(self.entry_weekend) self.load(self.spinbutton_instances_count) self.load(self.combobox_desc_style) self.load(self.switch_swap_d_and_m) self.load(self.switch_show_indicator_text) self.load(self.switch_block_sunrise__show) self.load(self.switch_block_moonrise__show) self.load(self.switch_always_on_top) self.adjustment_n_max.set_upper(gw_config_set['max_days']) if gw_config_set['show_bg_png'] == True: self.frame_not_image.hide() else: self.frame_image.hide() if gw_config_set['indicator_is_appindicator'] == 0: self.frame_app_indicator.hide() else: self.frame_status_icon.hide() self.liststore3.clear() for i in range(len(icons_list_set)): author = "" path = "" if os.path.exists(os.path.join(ICONS_PATH_SET, icons_list_set[i], 'author')): path = os.path.join(ICONS_PATH_SET, icons_list_set[i], 'author') if os.path.exists(os.path.join(ICONS_USER_PATH, icons_list_set[i], 'author')): path = os.path.join(ICONS_USER_PATH, icons_list_set[i], 'author') if path != "": f = open(path,"r") author = "\n"+"<i>"+_('Author')+": "+f.readline().strip()+"</i>" else: author = "\n"+"<i>"+_('Author')+": "+"Unknown"+"</i>" self.liststore3.append(["<b>"+icons_list_set[i]+"</b>"+author]) if icons_list_set[i] == gw_config_set['icons_name']: self.combobox_icons_name.set_active(i) self.liststore13.clear() for i in range(len(icons_list_set)): author = "" path = "" if os.path.exists(os.path.join(ICONS_PATH_SET, icons_list_set[i], 'author')): path = os.path.join(ICONS_PATH_SET, icons_list_set[i], 'author') if os.path.exists(os.path.join(ICONS_USER_PATH, icons_list_set[i], 'author')): path = os.path.join(ICONS_USER_PATH, icons_list_set[i], 'author') if path != "": f = open(path,"r") author = "\n"+"<i>"+_('Author')+": "+f.readline().strip()+"</i>" else: author = "\n"+"<i>"+_('Author')+": "+"Unknown"+"</i>" self.liststore13.append(["<b>"+icons_list_set[i]+"</b>"+author]) if icons_list_set[i] == gw_config_set['indicator_icons_name']: self.combobox_indicator_icons_name.set_active(i) self.liststore4.clear() for i in range(len(backgrounds_list_set)): author = "" path = "" if os.path.exists(os.path.join(BGS_PATH_SET, backgrounds_list_set[i], 'author')): path = os.path.join(BGS_PATH_SET, backgrounds_list_set[i], 'author') if os.path.exists(os.path.join(BGS_USER_PATH, backgrounds_list_set[i], 'author')): path = os.path.join(BGS_USER_PATH, backgrounds_list_set[i], 'author') if path != "": f = open(path,"r") author = "\n"+"<i>"+_('Author')+": "+f.readline().strip()+"</i>" else: author = "\n"+"<i>"+_('Author')+": "+"Unknown"+"</i>" self.liststore4.append(["<b>"+backgrounds_list_set[i]+"</b>"+author]) if backgrounds_list_set[i] == gw_config_set['bg_custom']: self.combobox_bg_custom.set_active(i) if autorun.exists("gis-weather"): self.switch_autostart.set_active(True) if desktop.main_exists(): self.switch_add_icon.hide() self.label_add_icon.hide() else: if desktop.exists(): self.switch_add_icon.set_active(True) self.liststore5.clear() for i in range(len(available_lang)): try: self.liststore5.append([dict_app_lang[available_lang[i]]]) except: self.liststore5.append([available_lang[i]]) if available_lang[i] == gw_config_set['app_lang']: self.combobox_app_lang.set_active(i) self.load_available_service_lang(service_set) state_lock = False