Exemple #1
0
    def RemplissageJours(self):
        calendrier = calendar.monthcalendar(self.selectionAnnee,
                                            self.selectionMois)

        for d in self.listeJours:
            b = Label(text=d, markup=True)
            self.box_grille.add_widget(b)

        for wk in range(len(calendrier)):
            for d in range(0, 7):
                dateOfWeek = calendrier[wk][d]
                if not dateOfWeek == 0:
                    date = datetime.date(self.selectionAnnee,
                                         self.selectionMois, dateOfWeek)
                    b = Button(text=str(dateOfWeek))
                    if date == self.selectionDate:
                        b.background_color = get_color_from_hex("30a3cc")
                        b.background_normal = ""
                    if date == datetime.date.today():
                        b.color = (1, 0, 0, 1)
                    b.bind(on_release=self.on_release)
                else:
                    b = Label(text='')
                self.box_grille.add_widget(b)

        # Mise à jour du titre
        self.ctrl_titre.text = "[b]" + self.listeMois[
            self.selectionMois - 1] + " " + str(self.selectionAnnee) + "[/b]"
Exemple #2
0
 def change_txti(self, instance, value=False):
     if (len(self.sel_txti.text) >= 26):
         self.sel_txti.text = instance.text[:25]
         try:
             Popup
         except:
             from kivy.uix.popup import Popup
         alert = FloatLayout()
         btn = Button(text="Ok",
                      size_hint=(.4, .2),
                      on_press=self.dismiss_popup)
         btn.pos_hint = {"x": 0.5 - (btn.size_hint[0] / 2), "y": 0.05}
         alert_msg = Label(text="O nome deve ter no\nmáximo 25 characters")
         alert_msg.halign = 'center'
         alert_msg.valign = 'middle'
         alert_msg.font_size = sp(17 * Window.size[1] / 600)
         alert_msg.size_hint = (0.4, 0.15)
         alert_msg.pos_hint = {
             "x": 0.5 - (alert_msg.size_hint[0] / 2),
             "y": 0.2 + btn.size_hint[1] + btn.pos_hint["y"]
         }
         alert_msg.background_color = (0.5, 1, 0.5, 0.5)
         alert.add_widget(alert_msg)
         alert.add_widget(btn)
         self._popup = Popup(title="Configurações",
                             content=alert,
                             size_hint=(0.5, 0.5))
         self._popup.open()
     else:
         pass
Exemple #3
0
 def RemplissageJours(self):
     calendrier = calendar.monthcalendar(self.selectionAnnee, self.selectionMois)
     
     for d in self.listeJours :
         b = Label(text=d, markup=True)
         self.box_grille.add_widget(b)
      
     for wk in range(len(calendrier)):
         for d in range(0,7):    
             dateOfWeek = calendrier[wk][d]
             if not dateOfWeek == 0:
                 date = datetime.date(self.selectionAnnee, self.selectionMois, dateOfWeek)
                 b = Button(text=str(dateOfWeek))
                 if date == self.selectionDate :
                     b.background_color = get_color_from_hex("30a3cc")
                     b.background_normal = ""
                 if date == datetime.date.today() :
                     b.color = (1, 0, 0, 1)
                 b.bind(on_release = self.on_release)
             else:
                 b = Label(text='')
             self.box_grille.add_widget(b)   
     
     # Mise à jour du titre
     self.ctrl_titre.text = "[b]" + self.listeMois[self.selectionMois-1] + " " + str(self.selectionAnnee) + "[/b]"
Exemple #4
0
    def add_widgets(self):
        tryout.init(updated=self.updated)
        self.pf_data = list(tryout.product_dict.values())
        if len(self.pf_data) == 0:
            return
        pf_nav = 0
        for pi in self.pf_data:
            pf_nav += pi.nav
        self.pf_nav = round(pf_nav, 2)
        prev_nav = tryout.get_prev_pf_nav()
        print(pf_nav, prev_nav)
        percent = round(((self.pf_nav - prev_nav) / prev_nav) * 100, 2)
        mov_str = str(percent)
        if prev_nav > pf_nav:
            mov_str = '[color=FF0000]' + str(abs(percent)) + '%[/color]'
        elif prev_nav < pf_nav:
            mov_str = '[color=00FF00] ' + str(percent) + '%[/color]'
        text = "Portfolio NAV is " + str(self.pf_nav) + '(' + mov_str + ')'
        labl = Label(
            text=text,
            markup=True,
            pos_hint=({
                'center_x': .5,
                'center_y': .95
            }),
            size_hint=(1, .09),
        )
        labl.background_color = (0.2, .6, 1, 1)
        button: Button = MDRaisedButton(
            pos_hint=({
                'center_x': .5,
                'center_y': .95
            }),
            size_hint=(1, .09),
        )

        button.background_color = (0.2, .6, 1, 1)
        button.bind(on_press=self.go_home)
        button.add_widget(labl)
        self.layout.add_widget(button)
        self.add_table_screens(self.pf_data)
        self.layout.add_widget(self.screens[0])
        self.add_nav_buttons()

        home_btn = MDIconButton(icon='home',
                                pos_hint={
                                    'center_x': 0.5,
                                    'center_y': 0.05
                                })
        home_btn.md_bg_color = (1, 1, 1, 1)
        home_btn.bind(on_press=self.go_home)
        self.layout.add_widget(home_btn)
        self.add_widget(self.layout)
Exemple #5
0
 def RefreshListOfItems(self):
     self.bill.clear_widgets()
     HeadingLabel = Label(text="Your Order",
                          color=utils.get_color_from_hex('#2F6CE5'))
     self.bill.add_widget(HeadingLabel)
     title = BoxLayout(orientation='horizontal')
     Item = Label(text="Item", color=utils.get_color_from_hex('#2F6CE5'))
     Price = Label(text="Price", color=utils.get_color_from_hex('#2F6CE5'))
     Qty = Label(text="Quantity", color=utils.get_color_from_hex('#2F6CE5'))
     Total = Label(text="Total", color=utils.get_color_from_hex('#2F6CE5'))
     title.add_widget(Item)
     title.add_widget(Price)
     title.add_widget(Qty)
     title.add_widget(Total)
     self.bill.add_widget(title)
     for i in range(len(order[0])):
         title = BoxLayout(orientation='horizontal')
         Item = Button(text=str(order[0][i]),
                       color=utils.get_color_from_hex('#FFFFFF'))
         Item.background_color = utils.get_color_from_hex('#2F6CE5')
         Item.bind(on_press=self.RemoveFromBill)
         Price = Label(text=str(order[1][i]),
                       color=utils.get_color_from_hex('#2F6CE5'))
         Qty = Label(text=str(order[2][i]),
                     color=utils.get_color_from_hex('#2F6CE5'))
         Total = Label(text=str(order[3][i]),
                       color=utils.get_color_from_hex('#2F6CE5'))
         title.add_widget(Item)
         title.add_widget(Price)
         title.add_widget(Qty)
         title.add_widget(Total)
         self.bill.add_widget(title)
     Total = Label(text="Total    Rs." + str(1.1 * sum(order[3])) +
                   "/-    (+10% Tax added)",
                   color=utils.get_color_from_hex('#2F6CE5'))
     self.bill.add_widget(Total)
     return
Exemple #6
0
 def check(self, btn):
     if (main.sel_icone.source == "source/img/icone/img_vazia.jpg"
             or self.sel_txti.text == ""
             or self.sel_txti.text == "Nome do personagem"):
         try:
             Popup
         except:
             from kivy.uix.popup import Popup
         alert = FloatLayout()
         btn = Button(text="Ok",
                      size_hint=(.4, .2),
                      on_press=self.dismiss_popup)
         btn.pos_hint = {"x": 0.5 - (btn.size_hint[0] / 2), "y": 0.05}
         if (main.sel_icone.source == "source/img/icone/img_vazia.jpg"):
             alert_msg = Label(
                 text="Selecione um personagem\nantes de jogar!!")
         else:
             alert_msg = Label(text="Escolha um nome para\nseu personagem")
         alert_msg.halign = 'center'
         alert_msg.valign = 'middle'
         alert_msg.font_size = sp(17 * Window.size[1] / 600)
         alert_msg.size_hint = (0.4, 0.15)
         alert_msg.pos_hint = {
             "x": 0.5 - (alert_msg.size_hint[0] / 2),
             "y": 0.2 + btn.size_hint[1] + btn.pos_hint["y"]
         }
         alert_msg.background_color = (0.5, 1, 0.5, 0.5)
         alert.add_widget(alert_msg)
         alert.add_widget(btn)
         self._popup = Popup(title="Configurações",
                             content=alert,
                             size_hint=(0.5, 0.5))
         self._popup.open()
     else:
         try:
             getnode
             post
         except:
             from requests import post
             from uuid import getnode
         ip = str(getnode())
         url = "http://10.0.0.109:5000/match"
         json = {"user_ip": ip, "user_name": self.sel_txti.text}
         headers = {"Content-Type": "application/json"}
         response = post(
             url=url, json=json, headers=headers,
             verify=False)  # envia token + json ignorando SSl(certificado)
         try:
             Popup
         except:
             from kivy.uix.popup import Popup
         alert = FloatLayout()
         btn = Button(text="Ok",
                      size_hint=(.4, .2),
                      on_press=self.dismiss_popup)
         btn.pos_hint = {"x": 0.5 - (btn.size_hint[0] / 2), "y": 0.05}
         if (response.status_code == 200):
             alert_msg = Label(text="Bem vindo de volta!!")
             self.free = True
         elif (response.status_code == 201):
             alert_msg = Label(text="Nome reservado!!")
             self.free = True
         else:
             alert_msg = Label(text="Nome já usado")
             self.free = False
         alert_msg.halign = 'center'
         alert_msg.valign = 'middle'
         alert_msg.font_size = sp(17 * Window.size[1] / 600)
         alert_msg.size_hint = (0.4, 0.15)
         alert_msg.pos_hint = {
             "x": 0.5 - (alert_msg.size_hint[0] / 2),
             "y": 0.2 + btn.size_hint[1] + btn.pos_hint["y"]
         }
         alert_msg.background_color = (0.5, 1, 0.5, 0.5)
         alert.add_widget(alert_msg)
         alert.add_widget(btn)
         self._popup = Popup(title="Configurações",
                             content=alert,
                             size_hint=(0.5, 0.5))
         self._popup.open()
Exemple #7
0
    def join(self, bt):
        try:
            post
            getnode
        except:
            from uuid import getnode
            from requests import post
        if (main.sel_icone.source == "source/img/icone/img_vazia.jpg"
                or self.sel_txti.text == "Nome do personagem"
                or self.sel_txti.text == ""):
            try:
                Popup
            except:
                from kivy.uix.popup import Popup
            alert = FloatLayout()
            btn = Button(text="Ok",
                         size_hint=(.4, .2),
                         on_press=self.dismiss_popup)
            btn.pos_hint = {"x": 0.5 - (btn.size_hint[0] / 2), "y": 0.05}
            if (main.sel_icone.source == "source/img/icone/img_vazia.jpg"):
                alert_msg = Label(
                    text="Selecione um personagem\nantes de jogar!!")
            else:
                alert_msg = Label(text="Escolha um nome para\nseu personagem")
            alert_msg.halign = 'center'
            alert_msg.valign = 'middle'
            alert_msg.font_size = sp(17 * Window.size[1] / 600)
            alert_msg.size_hint = (0.4, 0.15)
            alert_msg.pos_hint = {
                "x": 0.5 - (alert_msg.size_hint[0] / 2),
                "y": 0.2 + btn.size_hint[1] + btn.pos_hint["y"]
            }

            alert_msg.background_color = (0.5, 1, 0.5, 0.5)
            alert.add_widget(alert_msg)
            alert.add_widget(btn)
            self._popup = Popup(title="Configurações",
                                content=alert,
                                size_hint=(0.5, 0.5))
            self.pos_hint = {
                "x": 0.5 - (self._popup.size_hint[0] / 2),
                "y": 0.5 - (self._popup.size_hint[1] / 2)
            }
            self._popup.open()
        else:
            try:
                self.free
            except:
                difer = 2
                alert_msg = Label(text="Use o botão 'Check'!!")
            else:
                if (self.free == False):
                    difer = 1
                else:
                    difer = 0

            finally:
                if (difer == 0):
                    ip = str(getnode())
                    url = "http://10.0.0.109:5000/match"
                    json = {
                        "user_ip": ip,
                        "server": bt.id,
                        "user_name": self.sel_txti.text,
                        "personagem": selecao.perso_name
                    }
                    headers = {"Content-Type": "application/json"}
                    response = post(
                        url=url, json=json, headers=headers, verify=False
                    )  # envia token + json ignorando SSl(certificado)
                    play_layout = Play_Layout()
                    play_layout.update()
                    screen_manager.current = "play"
                    play.add_widget(play_layout)
                else:
                    if (difer == 2):
                        alert_msg = Label(text="Use o botão 'Check'!!")
                    else:
                        alert_msg = Label(
                            text="Nome indisponivel\nuse o botão 'Check'!!")
                    try:
                        Popup
                    except:
                        from kivy.uix.popup import Popup
                    alert = FloatLayout()
                    btn = Button(text="Ok",
                                 size_hint=(.4, .2),
                                 on_press=self.dismiss_popup)
                    btn.pos_hint = {
                        "x": 0.5 - (btn.size_hint[0] / 2),
                        "y": 0.05
                    }

                    alert_msg.halign = 'center'
                    alert_msg.valign = 'middle'
                    alert_msg.font_size = sp(17 * Window.size[1] / 600)
                    alert_msg.size_hint = (0.4, 0.15)
                    alert_msg.pos_hint = {
                        "x": 0.5 - (alert_msg.size_hint[0] / 2),
                        "y": 0.2 + btn.size_hint[1] + btn.pos_hint["y"]
                    }

                    alert_msg.background_color = (0.5, 1, 0.5, 0.5)
                    alert.add_widget(alert_msg)
                    alert.add_widget(btn)
                    self._popup = Popup(title="Configurações",
                                        content=alert,
                                        size_hint=(0.5, 0.5))
                    self.pos_hint = {
                        "x": 0.5 - (self._popup.size_hint[0] / 2),
                        "y": 0.5 - (self._popup.size_hint[1] / 2)
                    }
                    self._popup.open()