コード例 #1
0
class KivMobDemoUI(FloatLayout):
    def switch_to_screen(self, name, title):
        self.ids.toolbar.title = title
        self.ids.toolbar.left_action_items = [[
            "chevron-left", lambda x: self.back_to_menu()
        ]]
        self.ids.scr_mngr.transition.direction = "left"
        self.ids.scr_mngr.current = name
        self.interstitial_snack = Snackbar(
            text="Interstitial has not yet loaded.")

    def back_to_menu(self):
        self.ids.scr_mngr.transition.direction = "right"
        self.ids.scr_mngr.current = "menu"
        self.ids.toolbar.title = "KivMob 2.0"
        self.ids.toolbar.left_action_items = []

    def show_interstitial_msg(self):
        self.interstitial_snack.show()

    def hide_interstitial_msg(self):
        self.interstitial_snack.hide()

    def open_dialog(self):
        pass
コード例 #2
0
ファイル: transaction.py プロジェクト: We8Punk/ValutoPy
 def send_amount(self, **kwargs):
     #Not as pretty as i would like TODO
     App.get_running_app().network_manager.loadingstate = True
     try:
         if self.password == "ValutoPy":
             App.get_running_app().network_manager.send(self.address, self.amount)   
         else:    
             App.get_running_app().network_manager.lock_wallet()
             App.get_running_app().network_manager.set_passphrase(self.password, 100)
             App.get_running_app().network_manager.send(self.address, self.amount)   
             App.get_running_app().network_manager.lock_wallet() 
         Snackbar('It seems like the transaction went fine!').show() 
             
     except Exception as rpc_error:
         Snackbar(rpc_error[0]).show() 
         App.get_running_app().network_manager.loadingstate = False
         
     App.get_running_app().network_manager.loadingstate = False
         
     #Ugly hack, sry mama.... There seems to be a bug in KivyMD, so the button does not return to disable color, .
     self.amount_hint = ' '
     self.address_hint = ' '
     self.pass_hint = ' '
     self.amount_hint = ''
     self.address_hint = ''
     self.pass_hint = ''
     self.button_state = False
     self.button_state = True
コード例 #3
0
ファイル: test.py プロジェクト: AlessandroFC15/fut
 def show_example_snackbar(self, snack_type):
     if snack_type == 'simple':
         Snackbar(text="This is a snackbar!").show()
     elif snack_type == 'button':
         Snackbar(text="This is a snackbar", button_text="with a button!", button_callback=lambda *args: 2).show()
     elif snack_type == 'verylong':
         Snackbar(text="This is a very very very very very very very long snackbar!").show()
コード例 #4
0
    def number_validation_sanitation(self):
        popularity_value = self.ids.pop_num.text

        if popularity_value.isdigit():
            Global.POPULARITY = int(popularity_value)
        elif popularity_value is "":
            Global.POPULARITY = 0
        else:
            Snackbar(text="Popularity value must be numeric or disabled",
                     duration=2).show()
            return False

        if self.ids.rating_slider.disabled:
            Global.RATING = 0
        else:
            Global.RATING = int(round(self.ids.rating_slider.value))

        if len(Global.GENRES) < 1:
            Snackbar(text="You must select at least one Genre",
                     duration=2).show()
            return False

        if not self.ids.list_name.text:
            Snackbar(text="You must name this search", duration=2).show()
            return False

        return True
コード例 #5
0
 def LogInCheck(self, _user_, _pass_):
     if _user_ == 'a' and _pass_ == '':
         Snackbar(text="You're LogIn successfully!!!").show()
         self.root.ids.scr_mngr.current = 'Home_Screen'
         self.root.ids.nav_drawer.disabled = False
         self.root.ids.logged.disabled = True
     else:
         Snackbar(text="userName or password may be wrong !!!").show()
     pass
コード例 #6
0
 def switch_to_screen(self, name, title):
     self.ids.toolbar.title = title
     self.ids.toolbar.left_action_items = [[
         "chevron-left", lambda x: self.back_to_menu()
     ]]
     self.ids.scr_mngr.transition.direction = "left"
     self.ids.scr_mngr.current = name
     self.interstitial_snack = Snackbar(
         text="Interstitial has not yet loaded.")
コード例 #7
0
 def delete_data(self, id):
     try:
         self.data_object.import_id = id
         self.data_object.delete_import_detail()
         self.pagination_next(self.current)
     except KeyError:
         Snackbar(text=" Key Not Found ").show()
     except _mysql_exceptions.IntegrityError:
         Snackbar(
             text=
             "Cannot delete or update a parent row: a foreign key constraint fails"
         ).show()
コード例 #8
0
 def serialConnect(self):
     self.root.ids.spinner.active = True
     Snackbar(text="connecting...").show()
     checkConnection = True
     # connection = serialConnect
     if(checkConnection):
         Snackbar(text="connect success").show()
         self.serial = Serial(self.value)
         self.serial.login()
         self.serial.task()
         Clock.schedule_once(lambda dt: self.change_screen(), 3)
     else:
         Snackbar(text="connect fail").show()
         self.root.ids.spinner.active = False
コード例 #9
0
ファイル: storypixies.py プロジェクト: netpixies/storypixies
    def copy_story(self, story, library, new_name):
        if "{}: {}".format(library, new_name) in self.stories:
            Snackbar("Cannot create story. '{}' already exists in {}.".format(new_name, library)).show()
            return

        if self.stories[story]['library'] == library:
            source_story_file = Path(self.stories[story]['story'].story_config_file)
            dest_story_file = source_story_file.parent.joinpath("{}.ini".format(new_name))
            dest_story_file.write_bytes(source_story_file.read_bytes())
            new_story = self.app.libraries[library].add_new_story(new_name)
            if new_story is None:
                return None

            self.add_story(library, new_story)
            self.set_story = new_story
            self.set_library = library
            self.setup_settings_panel()
        else:
            source_story_file = Path(self.stories[story]['story'].story_config_file)
            dest_story_file = self.app.library_dir.joinpath(library).joinpath("{}.ini".format(new_name))
            dest_story_file.write_bytes(source_story_file.read_bytes())
            new_story = self.app.libraries[library].add_new_story(new_name)
            if new_story is None:
                return None

            self.add_story(library, new_story)
            self.set_story = new_story
            self.set_library = library
            self.setup_settings_panel()

        self.setup_settings_panel()
        self.app.story_title_screen()
コード例 #10
0
 def regis(self, name1, name2, email, phone, password):
     email = email.replace('.', '')
     data = {
         email: {
             'name': name1 + ' ' + name2,
             'phone': phone,
             'password': password,
             't1': '0',
             't2': '0',
             't3': '0',
             't4': '0',
             't5': '0',
             't6': '0',
             't7': '0',
             't8': '0'
         }
     }
     response = set_firebase('', data)
     if response == 0:
         pop.error_pop('please turn on internet')
         self.dialog.dismiss()
         return
     db.change_all_db(name1 + ' ' + name2, phone, email, '0', '0', '0', '0',
                      '0', '0', '0', '0')
     a = App.get_running_app()
     if a.info_state != 0:
         a.info_state = 1
     if db.get_status() != '0':
         a.event_scr_effects = [1, 1, 1, 1, 1, 1]
     db.change_status('1')
     a.main_widget.ids.logStatus.text = 'logout'
     self.dialog.dismiss()
     Snackbar(text="registered successfully").show()
     self.manager.current = 'vute'
コード例 #11
0
ファイル: login.py プロジェクト: datta07/Fest-App-for-Android
    def regis(self, email, password):
        if (email == '') | (password == ''):
            pop.error_pop('fill all the partuculars')
            self.dialog.dismiss()
            return

        email = email.replace('.', '')
        r2 = get_firebase(email)
        if r2 != 0:
            if (r2 == None):
                pop.error_pop('entered non registerd email address')
                self.dialog.dismiss()
                return
            r = str(r2['password'])
            if (r != password):
                pop.error_pop('incorrect password')
                self.dialog.dismiss()
                return
            db.change_all_db(r2['name'], r2['phone'], email, r2['t1'],
                             r2['t2'], r2['t3'], r2['t4'], r2['t5'], r2['t6'],
                             r2['t7'], r2['t8'])
            db.change_status('1')
            self.dialog.dismiss()
            a = App.get_running_app()
            if a.info_state != 0:
                a.info_state = 1
            a.event_scr_effects = [1, 1, 1, 1, 1, 1]
            Snackbar(text="login success").show()
            a.main_widget.ids.logStatus.text = 'logout'
            #self.manager.=FadeTransition
            self.manager.current = 'vute'
        else:
            pop.error_pop('no internet connection')
            self.dialog.dismiss()
コード例 #12
0
 def call_get_menu(self, url="", selector="", port=70):
     if "gopher://" in url:
         protocol, uri = url.split("://")
         log.info("Protocol: {}".format(protocol))
         log.info("URI: {}".format(uri))
     else:
         uri = url
     uri_components = uri.split("/")
     final_url = uri_components[0]
     self.title_url = final_url
     if len(uri_components[-1]) > 0 and uri_components[-1] != final_url:
         selector = uri_components[-1]
     try:
         menu_list = get_menu(selector, final_url, port)
         previous_menu = [selector, final_url, port]
         if len(self.previous_menu_details) > 0:
             self.menu_list.append(self.previous_menu_details)
         self.previous_menu_details = previous_menu
         self.title_selector = selector
     except Exception as e:
         log.exception(e)
         Snackbar(text=str(e.args[-1])).show()
         if self.menu_list:
             return self.call_get_menu(selector=self.menu_list[-1][0],
                                       url=self.menu_list[-1][1],
                                       port=self.menu_list[-1][2])
         else:
             return []
     return menu_list
コード例 #13
0
ファイル: storypixies.py プロジェクト: netpixies/storypixies
    def create_new_library(self, library):
        if len(library) == 0:
            Snackbar("Please enter a new library name.").show()
            return

        library_path = self.app.library_dir.joinpath(library)
        if library_path.exists():
            Snackbar("Library already exists. Select new name.").show()
            return

        library_path.mkdir()

        self.app.libraries[library] = SingleLibrary(name=library, library_dir=library_path)
        self.copy_story("Templates: All About You", library, "All About You")
        self.setup_settings_panel()
        self.app.story_title_screen()
コード例 #14
0
    def on_instagram_login(self, username, password):
        try:
            instagram_object = instagram_login(username.text, password.text)
            #self.loading_box()
            #Snackbar(text="Please wait for sometime, lets us fetch your Insta Handle").show()

            max_id, posts = get_all_posts(instagram_object)

            Logger.info("Now fetching images from instagram")
            save_instagram(posts)
            # with open("instagram.data","wb") as f:
            #     pickle.dump(posts, f)
            store.put("instagram",
                      max_id=max_id,
                      time_zone=time.tzname,
                      last_fetch_utc=datetime.datetime.utcnow().timestamp(),
                      last_fetch_local=datetime.datetime.now(
                          datetime.timezone.utc).astimezone().isoformat())

        except Exception as e:
            Logger.error(e)
            Snackbar(
                text="Please check your instragram username and password again"
            ).show()
        return
コード例 #15
0
 def Add_to_DB(self, text):
     filename = text
     db = mysql.connector.connect(host='localhost',
                                  user='******',
                                  passwd='P@$$W0RD')
     my = db.cursor()
     #my.execute('create database Voice_Comparer')
     my.execute('use Voice_Comparer')
     try:
         with open(filename) as csvfile:
             ader = csv.reader(csvfile)
             a = 0
             for row in ader:
                 # Inserting into database
                 sql = 'Insert into student values (%s , %s , %s , %s , %s , %s)'
                 values = (
                     row[0],
                     row[1],
                     row[2],
                     row[3],
                     row[4],
                     row[5],
                 )
                 sql_ = 'select * from student where StudentID = %s'
                 k = 1
                 my.execute(sql_, (row[0], ))
                 myresult = my.fetchall()
                 a += 1
                 if len(myresult) > 0:
                     k = 0
                 else:
                     k = 1
                 if k == 1:
                     my.execute(sql, values)
                     print('This record %d is inserted' % a)
                     db.commit()
                 else:
                     print('This record %d is already inserted' % a)
                 print(my.rowcount, "record inserted.")
                 my.execute('select count(*) from student')
                 res = my.fetchone()
             Snackbar(text='Data Added to DataBase').show()
             print('%d rows Presented in The student table ' % res)
     except:
         Snackbar(text='File Not Found').show()
     pass
コード例 #16
0
ファイル: main.py プロジェクト: mcroni/pypod
 def on_touch_down(self, touch):
     if self.collide_point(*touch.pos):
         self.pressed = touch.pos
         print(str(self.provider))
         print(self.liked)
         Snackbar(text="You liked this podcast!").show()
         return True
     super(IconRightSampleWidget, self).on_touch_down(touch)
コード例 #17
0
 def add_data(self, name):
     self.data_object.name = name
     if name != '':
         self.data_object.insert_category()
     else:
         Snackbar(text=" You Need To Fill Name Field ").show()
     self.pagination_next()
     self.call_load()
コード例 #18
0
ファイル: storypixies.py プロジェクト: netpixies/storypixies
    def copy_story_from_ids(self, copy_story_from_box, copy_story_library_id, copy_story_box):
        source_story = copy_story_from_box.text
        dest_library = copy_story_library_id.library
        new_name = copy_story_box.text

        if source_story is None:
            Snackbar("Please select a source story to copy.").show()
            return

        if dest_library is None:
            Snackbar("Please select a destination library.").show()
            return

        if len(new_name) == 0:
            Snackbar("Please enter a new story name.").show()
            return

        self.copy_story(source_story, dest_library, new_name)
コード例 #19
0
 def delete_data(self, id):
     try:
         self.export_object.id = id
         self.export_object.delete_export()
         self.pagination_next(self.current)
     except KeyError:
         print "Key Not Found"
     except _mysql_exceptions.IntegrityError:
         Snackbar(text=str("You Cannot Delete This Record")).show()
コード例 #20
0
 def add_data(self, destination, date, status):
     self.export_object.destination = destination
     self.export_object.date = date
     self.export_object.status = status
     if destination != '' and date != '' and status != '':
         self.export_object.insert_export()
     else:
         Snackbar(text=" You Need To Fill All Fields ").show()
     self.call_load()
コード例 #21
0
 def delete_data(self, id):
     try:
         self.data_object.id = id
         self.data_object.delete_supplier()
         self.pagination_next(self.current)
     except KeyError:
         print "Key Not Found"
     except e:
         Snackbar(text=str(e)).show()
コード例 #22
0
    def add_new_voucher(self, date, submitted_by, status):
        self.data_object.date = date
        self.data_object.submitted_by = submitted_by
        self.data_object.status = status

        if date != '':
            if submitted_by != '' and status != '':
                self.data_object.insert_voucher()
                current_vouch = self.data_object.execute(
                    "SELECT id FROM vouchers ORDER BY id DESC LIMIT 1"
                )[0]['id']
                self.current_voucher = current_vouch
            else:
                Snackbar(text=" You Need To Fill All Fields ").show()
        else:
            Snackbar(text=" You Need To Add Barcode It's Important ").show()

        self.pagination_next()
        self.call_load()
コード例 #23
0
    def progress(self):
        step = 1
        while self.progressbar.value < 100:
            self.progressbar.value += step
            time.sleep(.2)
            if self.ready:
                step += 2

        self.styled_img.children[0].children[0].source = self.styled_image_path
        Snackbar(text="Image is downloaded!").show()
コード例 #24
0
 def add_data(self, receipt_number, date, supplier_id, status):
     self.data_object.receipt_number = receipt_number
     self.data_object.date = date
     self.data_object.supplier_id = supplier_id
     self.data_object.status = status
     if receipt_number != '' and date != '' and supplier_id != '' and status != '':
         self.data_object.insert_import()
     else:
         Snackbar(text=" You Need To Fill All Fields ").show()
     self.call_load()
コード例 #25
0
    def on_save(self, passphrase, repeat_passphrase):
        if not self.mnemonic:
            Snackbar(text="PLease generate a New mnemonic").show()
            return
        if passphrase.text != repeat_passphrase.text or not passphrase.text:
            Snackbar(text="Passphrases must match").show()
            return

        if len(passphrase.text) < 8:
            Snackbar(
                text="Passphrases must be at least 8 characters long").show()
            return

        scrypt_key, salt = generate_scrypt_key(passphrase.text)
        encrypted_mnemonic = aes_encrypt(scrypt_key, self.mnemonic)

        store.put("mnemonic", value=encrypted_mnemonic.hex(), salt=salt.hex())
        store.put("address", value=self.address)
        return
コード例 #26
0
ファイル: feed.py プロジェクト: datta07/Fest-App-for-Android
 def send_fed1(self, t):
     phone = db.get_db('phone')
     data1 = {phone: t}
     response = set_firebase('feedback', data1)
     self.dialoga.dismiss()
     if response == 0:
         pop.error_pop('please on internet')
     else:
         Snackbar(text="Thanks for feedback").show()
         self.manager.current = 'vute'
コード例 #27
0
 def validate_barcode(self, barcode):
     if barcode != '':
         result = self.data_object.execute(
             "SELECT brandname FROM products WHERE barcode=" + barcode)
         print result
         if result == ():
             pass
         else:
             Snackbar(text=" barcode is already used BrandName is " +
                      str(result[0]["brandname"])).show()
コード例 #28
0
 def add_data(self, product_barcode, brandname, genericname,
              quantityperunit, unitprice, category_id, expiry_date, status):
     self.data_object.barcode = product_barcode
     self.data_object.brandname = brandname
     self.data_object.genericname = genericname
     self.data_object.quantityperunit = quantityperunit
     self.data_object.unitprice = unitprice
     self.data_object.category_id = category_id
     self.data_object.expiry_date = expiry_date
     self.data_object.status = status
     if product_barcode != '':
         if brandname != '' and genericname != '' and quantityperunit != '' and unitprice != '' and category_id != '' and expiry_date != '' and status != '':
             self.data_object.insert_product()
         else:
             Snackbar(text=" You Need To Fill All Fields ").show()
     else:
         Snackbar(text=" You Need To Add Barcode It's Important ").show()
     self.pagination_next()
     self.call_load()
コード例 #29
0
 def open_episode_page_with_string(self, string, *_):
     print('aight lets go')
     Global.MAIN_WIDGET.ids.home.ids.home_spinner.active = True
     Snackbar(
         text="Fetching torrents for: "+ string, duration=2).show()
     self.ids.home_spinner.active = True
     yield Task(functools.partial(Global.EPISODE_PAGE_CLASS.search,string))
     self.manager.transition.direction = 'left'
     self.manager.current = 'ep_page'
     Global.MAIN_WIDGET.ids.home.ids.home_spinner.active = False
コード例 #30
0
 def add_data(self, name, address, contact):
     self.data_object.name = name
     self.data_object.address = address
     self.data_object.contact = contact
     if name != '' and address != '' and contact != '':
         self.data_object.insert_supplier()
     else:
         Snackbar(text=" You Need To Fill All Fields ").show()
     self.pagination_next()
     self.call_load()