Esempio n. 1
0
 def run(self):
     self.instance._is_checking_url = True
     url = self.instance.entry.get_text()
     try:
         is_valid_ical_url(url)
         settings.update_settings("Timetable", "user_url", url)
         self.instance.info_label = "URL Verified and saved!"
     except Exception:
         self.instance.info_label = "Unable to verify, or invalid URL."
     self.instance._is_checking_url = False
Esempio n. 2
0
 def on_confirm_clicked(self, widget):
     hex_input = self.hex_entry.get_text()
     days_input = int(self.days_entry.get_text())
     self.info_text = ""
     if is_valid_hex(hex_input):
         settings.update_settings("Conky", "color", hex_input)
     else:
         self.info_text += "This does not seem to be a valid hex"
     if 8 > days_input > 0:
         settings.update_settings("Conky", "days", days_input)
     else:
         self.info_text += "\nDays value must be between 1 and 7"
Esempio n. 3
0
 def on_confirm_clicked(self, widget):
     hex_input = self.hex_entry.get_text()
     days_input = int(self.days_entry.get_text())
     self.info_text = ""
     if is_valid_hex(hex_input):
         settings.update_settings("Conky", "color", hex_input)
     else:
         self.info_text += "This does not seem to be a valid hex"
     if 8 > days_input > 0:
         settings.update_settings("Conky", "days", days_input)
     else:
         self.info_text += "\nDays value must be between 1 and 7"
Esempio n. 4
0
    def get_unread_email(self):
        mail_service = self.connection
        if mail_service is None:
            self.connection = self.connect_to_account()
        else:
#            print("Mail service is not none ->", mail_service)
            result, data = mail_service.uid("search", None, "UNSEEN")
            if self.mail_settings["first_time"]:
                settings.update_settings("EMail", "first_time", False)
                dbc.add_mail_uid(data[0].split())
            else:
                new_mail_uids = dbc.get_mail_not_read(data[0].split())
                mail_notifications = []
                if len(new_mail_uids) != 0:
                    for mail_uid in new_mail_uids:
                        result, data = mail_service.uid('fetch', mail_uid, "(RFC822)")
                        raw_email = data[0][1]
                        #print("Raw email is:", type(raw_email))
                        email_message = email.message_from_bytes(raw_email)
                        mail_notifications.append(EMail(email_message["From"]))
                    #print("nr of notifications added:", len(mail_notifications))
                    dbc.add_to_db(mail_notifications)
Esempio n. 5
0
 def set_active_in_settings(self, state):
     settings.update_settings(self.menu_item_lbl, "activated", state)
def save_to_keyring(username, password):
    """
    Sets the username and password in the keyring that the keyring module deems appropriate.
    """
    settings.update_settings("EMail", "username", username)
    keyring.set_password("EITC-kit", username, password)