def toggle_show(self, button, option):
     self.mute_yesterday = not clt.config["MUTE"].getboolean("yesterday")
     self.mute_today = not clt.config["MUTE"].getboolean("today")
     self.mute_week = not clt.config["MUTE"].getboolean("week")
     self.mute_month = not clt.config["MUTE"].getboolean("month")
     self.mute_cycle = not clt.config["MUTE"].getboolean("cycle")
     self.mute_shadow = not clt.config["MUTE"].getboolean("shadow")
     new_state = not button.get_active()
     clt.config["MUTE"][option] = str(new_state)
     with open(clt.config_file, 'w') as cf:
         clt.config.write(cf)
     try:
         if option == "yesterday":
             self.set_yesterday_state()
         elif option == "today":
             self.set_today_state()
         elif option == "week":
             self.set_week_state()
         elif option == "month":
             self.set_month_state()
         elif option == "cycle":
             self.set_cycle_state()
         elif option == "shadow":
             self.set_shadow_state()
     except UnboundLocalError:
         pass
     clt.restart_data()
 def change_interface(combo):
     tree_iter = combo.get_active_iter()
     if tree_iter is not None:
         model = combo.get_model()
         text = model[tree_iter][0]
         clt.config["GENERAL"]["interface"] = text
         with open(clt.config_file, 'w') as cf:
             clt.config.write(cf)
     clt.restart_data()
 def change_display(combo):
     tree_iter = combo.get_active_iter()
     if tree_iter is not None:
         model = combo.get_model()
         text = model[tree_iter][0]
         idx = ["Short", "Long", "Detailed", "Minimal"].index(text)
         clt.config["GENERAL"]["display"] = str(idx)
         with open(clt.config_file, 'w') as cf:
             clt.config.write(cf)
     clt.restart_data()
 def update_datacap(self, button):
     clt.config["GENERAL"]["datacap_num"] = str(self.datacap_spinbox.get_value_as_int())
     tree_iter = self.datacap_combo.get_active_iter()
     if tree_iter is not None:
         model = self.datacap_combo.get_model()
         text = model[tree_iter][0]
         idx = ["KB", "MB", "GB", "TB"].index(text)
         clt.config["GENERAL"]["datacap_type"] = str(idx)
     with open(clt.config_file, 'w') as cf:
         clt.config.write(cf)
     clt.restart_data()
 def get_xy(self, button):
     x = self.x_pos.get_text()
     y = self.y_pos.get_text()
     # check for correct input
     try:
         new_pos = [str(int(p)) for p in [x, y]]
         clt.config["GENERAL"]["position"] = ",".join(new_pos)
         with open(clt.config_file, 'w') as cf:
             clt.config.write(cf)
     except (FileNotFoundError, ValueError, IndexError):
         pass
     clt.restart_data()
 def toggle_cuspos(self, button):
     new_state = button.get_active()
     for widget in [
         self.y_pos, self.x_pos, self.xpos_label, self.ypos_label, self.apply
     ]:
         widget.set_sensitive(new_state)
     if new_state is False:
         self.x_pos.set_text("")
         self.y_pos.set_text("")
         clt.config["GENERAL"]["position"] = ",".join(["900", "50"])
         clt.config["GENERAL"]["custom_position"] = "False"
         with open(clt.config_file, 'w') as cf:
             clt.config.write(cf)
         clt.restart_data()
     else:
         clt.config["GENERAL"]["custom_position"] = "True"
         with open(clt.config_file, 'w') as cf:
             clt.config.write(cf)
 def __init__(self, uuid):
     Budgie.Applet.__init__(self)
     self.uuid = uuid
     clt.restart_data()