Ejemplo n.º 1
0
 def post_coords(self):
     try:
         mr = []
         targetlogs = list(filter(lambda x: '.json' in x and '_' in x, os.listdir(App().user_data_dir)))
         targetlogs.sort(key=lambda x: datetime.strptime(x.split('.')[0], '%d_%m_%y_%H_%M_%S'))
         for log in targetlogs:
             targetlog = JsonStore(App().user_data_dir + '/' + log)
             data = [targetlog[i] for i in targetlog]
             mr += data
         if mr:
             d = {
                 "track": mr,
                 "name": 'trackname' + datetime.now().strftime('%d_%m_%y_%H_%M_%S'),
                 "user": '******',
                 "description": 'from Android app'
             }
             headers = {
                 'contentType': 'application/json; charset=utf-8',
                 'dataType': 'json'
             }
             requests.post('http://wilder.pythonanywhere.com/map/savetrack', json=d, headers=headers)
         kwargs = {'title': 'F**k Yeeeah!', 'message': 'Yo coords upload on server!'}
         notification.notify(**kwargs)
         for log in targetlogs:
             os.remove(App().user_data_dir + '/' + log)
     except Exception as e:
         t = open(str(App().user_data_dir) + '/' + 'lll.txt', 'w')
         t.write(str(e))
         t.write(str(os.listdir(App().user_data_dir)))
         t.write(self.data_dir)
         t.write(os.name)
         t.close()
Ejemplo n.º 2
0
Archivo: main.py Proyecto: nvmanh/Fish
 def on_keyboard_down(self, keyboard, keycode, text, modifiers):
     if keycode[1] == 'up':
         self.ids.game.use('up', 1)
     elif keycode[1] == 'down':
         self.ids.game.use('down', 1)
     elif keycode[1] == 'left':
         self.ids.game.use('left', 1)
     elif keycode[1] == 'right':
         self.ids.game.use('right', 1)
     elif keycode[1] == 'w':
         self.ids.game.use('up', 1)
     elif keycode[1] == 'a':
         self.ids.game.use('left', 1)
     elif keycode[1] == 's':
         self.ids.game.use('down', 1)
     elif keycode[1] == 'd':
         self.ids.game.use('right', 1)
     elif keycode[1] == 'escape':
         try:
             App().stop()
         except:
             pass
     elif keycode[1] == 'p':
         self.pause_game()
     return True
Ejemplo n.º 3
0
    def setUp(self, no_db=False):
        super().setUp()
        if not hasattr(self, "app"):
            self.app = App()
            Path(self.app.get_application_config()).unlink(missing_ok=True)
            if not self.app.config:
                self.app.config = ConfigParser()
                self.app.build_config(self.app.config)
            config = self.app.config
            for section, values in DEFAULT_SETTINGS.items():
                config.setdefaults(section, values)
            if not no_db:
                init_update_matiere(db, reset=True)
                with db_session:
                    for entity in db.entities.values():
                        if entity.__name__ != "Matiere":
                            delete(e for e in entity)

        self.T = TempFile()

        EventLoop.ensure_window()
        self.window = EventLoop.window

        if self.TIMER:
            self.debut_time = time.time()
Ejemplo n.º 4
0
def voltar():
    janela = App()
    Window.clearcolor = [0, 0, 0, 0]
    Window.size = 800, 600
    janela.title, janela.build = 'Contabilidade Cabral', build
    janela2.stop()
    janela.run()
Ejemplo n.º 5
0
def mesajAL(sock, sun_EKRAN, key, ip):
    global CONNECTION
    kosul = True
    while kosul:
        try:
            mesaj = sock.recv(RECV_BUFFER)

            if mesaj.startswith("0MSG"):
                mesaj = mesaj[4:]
                mesaj = cipher.decipher(sun_EKRAN.kapaliKEY, mesaj)
                sun_EKRAN.mesajAl.text += "<{}> ".format(ip) + mesaj + "\n"

            if mesaj.startswith("0KEY"):
                sock.sendall("0KEY" + key)

            if mesaj == "QUIT":
                CONNECTION = True
                Window.on_close = App().stop
                sock.close()
                sun_EKRAN.mesajAl.text += u"{} kullanýcýsý konuþmadan ayrýldý. ".format(
                    ip) + "\n"

        except Exception as e:
            sock.close()
            kosul = False
            hata = e.args[0]
            if hata == 10054:
                sun_EKRAN.mesajAl.text += u"{} kullanýcýsýnýn baðlantýsý koptu ".format(
                    ip) + "\n"
                Window.on_close = App.stop
Ejemplo n.º 6
0
def GetRepData():
    a = App()
    rep = os.path.join(a.user_data_dir, "nomadhys")
    if not os.path.isdir(rep):
        Logger.info("Creation du repertoire %s" % rep)
        os.mkdir(rep)
    del a
    return rep
Ejemplo n.º 7
0
 def write_data(self, data):
     try:
         if data:
             self.f.put(self.t.strftime('%d-%m-%y_%H:%M:%S'), lat=data['lat'], lng=data['lng'])
     except Exception as e:
         t = open(str(App().user_data_dir) + '/' + 'lll.txt', 'w')
         t.write(str(e))
         t.close()
Ejemplo n.º 8
0
    def build(self):
        a = App()
        popup = Popup_parametres(callback=self.Test)
        popup.open()

        popup.AfficherPage("Kivy")

        return popup
 def messager(self, msg):
     the = App().get_running_app()
     plyer.notification.notify(title=msg,
                               message=msg,
                               app_name=the.name,
                               timeout=1,
                               ticker='New Incoming Notification',
                               toast=True)
Ejemplo n.º 10
0
    def __init__(self):
        """ Initialize a KvApplication.

        """
        super(KvApplication, self).__init__()
        self._kvapp = App()
        self._kvapp.build = self.build
        self.resolver = ProxyResolver(factories=kv_factories.KV_FACTORIES)
        kv_factories.KV_FACTORIES = self.resolver.factories  # So any dynamic loads get added
Ejemplo n.º 11
0
 def yenisocket(self):
     try:
         Window.on_close = App().stop
         if self.s_sock:
             self.s_sock.sendall("QUIT")
     except Exception as e:
         print e
     finally:    
         self.sock.close()
Ejemplo n.º 12
0
class ResGenApp(App):
        title = 'Heimdall'
        App.icon  = 'lapiscoIcon.png'
        data_dir = App().user_data_dir
        print(data_dir)
        store = JsonStore(join(data_dir, 'storage.json'))
        print(App.icon)

        def build(self):

                return Manager()
Ejemplo n.º 13
0
    def test_kivy(self):
        try:
            from async_gui.toolkits.kivy import KivyEngine
            from kivy.app import App
            from kivy.clock import Clock
        except ImportError:
            return self.skipTest("Kivy not installed")

        called = [False]
        root = App()
        Clock.schedule_once(
            lambda e: self._check_toolkit(KivyEngine, root, root.stop, called))
        root.run()
        self.assertTrue(called[0])
Ejemplo n.º 14
0
    def __init__(self, app=None, *args, **kwargs):
        if app is None:
            app = App()
        EventLoop.safe = Event()
        self.safe = EventLoop.safe
        self.safe.set()
        EventLoop.confirmed = Event()
        self.confirmed = EventLoop.confirmed
        self.app = app

        def startApp(app=app, *args, **kwargs):
            app.run(*args, **kwargs)

        self.thread = Thread(target=startApp, *args, **kwargs)
Ejemplo n.º 15
0
def mesajAL(sock, loader1, sayfa, kul_EKRAN, ip, yonetici):
    kosul = True
    alert = Alert()
    warning = WarningP()
    while kosul:

        try:
            data = sock.recv(4096)

            if data.startswith("0KEY"):

                kul_EKRAN.acikKEY = data[4:]
                if kul_EKRAN.acikKEY == None:
                    sock.sendall("0KEY")

            if data.startswith("0MSG"):
                mesaj = data[4:]
                mesaj = cipher.decipher(sayfa.kapaliKEY, mesaj)
                kul_EKRAN.mesajAl.text += "<{}> ".format(ip) + mesaj + "\n"

            if data == "QUIT":
                kosul = False
                alert.text.text = u"{} mesajlaþmadan \n ayrýldý.".format(ip)
                sock.close()
                Window.on_close = App().stop
                yonetici.current = "katilSayfa"
                alert.open()

            if data == "WPAS":
                alert.text.text = u"Yanlýþ þifre girdiniz!"
                sock.close()
                yonetici.current = "katilSayfa"
                alert.open()

        except Exception as e:
            if e.args == 10054:
                warning.text = u"{}'nýn baðlantýsý koptu.".format(ip)
                sock.close()
                yonetici.current = "katilSayfa"
                warning.open()

            kosul = False
            print e.args[0]
Ejemplo n.º 16
0
class LoginWindow(Screen):
    email = ObjectProperty(None)
    password = ObjectProperty(None)
    data_dir = App().user_data_dir
    store = JsonStore(os.path.join(data_dir, 'storage.json'))

    def loginBtn(self):
        # validate user here
        MainWindow.current = self.email.text
        self.reset()
        sm.current = "main"
        # else:
        #     invalidLogin()

    def createBtn(self):
        self.reset()
        sm.current = "create"

    def get_user(self):
        try:
            user = LoginWindow.store.get('credentials')['username']
        except KeyError:
            user = ""

        return user

    def get_pass(self):
        try:
            passwd = LoginWindow.store.get('credentials')['password']
        except KeyError:
            passwd = ""

        return passwd

    def reset(self):
        self.save_login()
        self.email.text = ""
        self.password.text = ""

    def save_login(self):
        email = self.email.text
        passwd = self.password.text
        LoginWindow.store.put('credentials', username=email, password=passwd)
Ejemplo n.º 17
0
class UserCred(object):
    data_dir = App().user_data_dir
    store = JsonStore(os.path.join(data_dir, 'login.json'))

    @staticmethod
    def store_cred(email, password):
        UserCred.store.put('credentials', email=email, password=password)

    @staticmethod
    def load_cred():
        '''
        Load user-email, password
        '''
        try:
            creds = UserCred.store.get('credentials')
            email = creds['email']
            password = creds['password']
        except:
            return "", ""

        return email, password
Ejemplo n.º 18
0
        self.inside.add_widget(self.lastName)

        self.inside.add_widget(Label(text="Email: "))
        self.email = TextInput(multiline=False)
        self.inside.add_widget(self.email)

        self.add_widget(self.inside)

        self.submit = Button(text="Click for CovidNews", font_size=30)
        self.submit.bind(on_press=self.news_pressed)
        self.add_widget(self.submit)

        self.submit1 = Button(text="Click for CovidStocks", font_size=30)
        self.submit.bind(on_press=self.finance_pressed)
        self.add_widget(self.submit1)

    def finance_pressed(self, instance):
        finance_news()

    def news_pressed(self, instance):
        NewsPuller.getNews()


class App(App):
    def build(self):
        return Grid()


if __name__ == '__main__':
    App().run()
Ejemplo n.º 19
0
# coding: utf-8
# Udemy - 19/04/2017
from kivy.app import App
from kivy.uix.textinput import TextInput


def build():
    return TextInput(text="texto pre definido")


janela = App()
janela.build = build
janela.run()
Ejemplo n.º 20
0
 def setup(self):
     # load test data
     self.app = App(database='fixtures/test_basic.json')
Ejemplo n.º 21
0
 def setUp(self):
     # load test data
     self.app = App(database='fixtures/test_complex.json')
Ejemplo n.º 22
0
 def test_user_data_dir(self):
     a = App()
     data_dir = a.user_data_dir
     if not os.path.exists(data_dir):
         raise Exception("user_data_dir does not exist")
Ejemplo n.º 23
0
#conding: utf-8

from kivy.app import App
from kivy.uix.label import Label


def build():
    lb = Label()
    lb.text = "Hello Kivy World"
    lb.italic = True
    lb.font_size = 50
    #size em tamanho de pixels
    return lb


if __name__ == '__main__':
    uma_var_qlqr = App()
    uma_var_qlqr.build = build
    uma_var_qlqr.run()
Ejemplo n.º 24
0
#!usr/bin/env python3
# coding UTF-8

from kivy.app import App
from kivy.uix.textinput import TextInput


def build():
    ti = TextInput()
    ti.text = "Text Input Component"
    return ti


window = App()
window.build = build
window.run()
 def clk_exit(self):
     App().stop()
Ejemplo n.º 26
0
# -*- coding: utf-8 -*-

from kivy.app import App

from kivy.uix.button import Button


def click () :

    print ( 'Clicked' )

def build () :

    btn = Button ( text = 'Click', font_size = 20 )

    btn.on_press = click

    return btn


Root = App ()

Root.build = build

Root.run ()
Ejemplo n.º 27
0
#coding: utf-8

# importamos as bibliotecas
from kivy.app import App
from kivy.uix.label import Label

#Funcao que ira retornar os componentes
def build(): # Função que acrescenta os componentes
    return Label(text = "Hello World")

#App().run() roda a aplicação

#atribuir os elementos da blioteca para o hello world
hello_word = App() # associa a instancia do app ao aplicativo que queremos criar
hello_word.build = build
hello_word.run()
Ejemplo n.º 28
0
# coding: utf-8

from kivy.app import App
from kivy.uix.label import Label


def build():
    return Label(text="Hello World")


hello_world = App()
hello_world.build = build
hello_world.run()
Ejemplo n.º 29
0
#coding = utf-8

from kivy.app import App
from kivy.uix.textinput import TextInput


def build():
    return TextInput(text="Componente TextInput")


app = App()
app.build = build
app.run()
Ejemplo n.º 30
0
 def test_start_raw_app(self):
     lang._delayed_start = None
     a = App()
     Clock.schedule_once(a.stop, .1)
     a.run()