Ejemplo n.º 1
0
    def save_product(self):
        #get of the production information (name, buy price, sell price, code, quantity)
        name = self.ids.product_name.text
        buy_price = self.ids.buy_price.text
        sell_price = self.ids.sell_price.text
        code = self.ids.code.text
        quantity = self.ids.quantity.text
        #reset of the textinputs
        self.ids.product_name.text = ''
        self.ids.buy_price.text = ''
        self.ids.sell_price.text = ''
        self.ids.code.text = ''
        self.ids.quantity.text = ''
        #save of the product into the database
        self.database.set_product(name=name, buy_price=buy_price, sell_price=sell_price, code=code, quantity=quantity)
        #add of the product in the widget (display in the app)
        self.ids.product.add_widget(
            TwoLineIconListItem(
                text=f'[b]{name}[/b] ',
                secondary_text=f'{buy_price}$\n    {sell_price}$',
                secondary_font_style='Subtitle2',
                on_press=self.show_example_bottom_sheet,

                )#.add_widget(IconLeftSampleWidget(icon='account-card-details'))
        )
        #reload of the total prices on the screen
        self.display_total_prices()
Ejemplo n.º 2
0
    def on_enter(self):
        """on enter method of the detail view"""
        number = int(self.manager.screen_one.number)
        visits = self.database.get_visits(number)
        visit_size = len(visits)
        #visit string to display (plural of only one)
        if visit_size == 1:
            visit_string = 'visit'
        else:
            visit_string = 'visits'

        customer = self.database.get_customer_by_number(number)
        self.ids.detail_header.text = f'[b]{customer[1]}[/b]'
        self.ids.detail_header.secondary_text = f'{number}              {visit_size} ' + visit_string
        for visit in visits:
            #formating of the date and time of the visits
            visit_date = time.strftime('%d-%m-%Y', time.localtime(visit[2]))
            visit_time = time.strftime('%H:%M', time.localtime(visit[2]))
            #display of the detail with visits
            self.ids.detail_motifs.add_widget(
                TwoLineIconListItem(text=f'{visit[3]}',
                                    secondary_text=visit_time + '     ' +
                                    visit_date,
                                    secondary_font_style='Subtitle2',
                                    divider='Inset',
                                    disabled=True))
Ejemplo n.º 3
0
 def get_recent(self, dt=0):
     logs = self.client.calls.list()
     for log in logs:
         self.ids.time.text = str(log.start_time)
         dc = log.date_created.strftime("%d:%m:%y")
         tm = log.end_time.strftime("%H:%M:%S")
         recent = TwoLineIconListItem(
             text=f"        [font=RobotoLight]{log.to}[/font]",
             text_color=[0, 0, 0, 1],
             secondary_text=
             f"         {log.duration}sec               {dc}      {tm}",
             secondary_text_color=[0, 1, 0, 1],
             bg_color=[1, 1, 1, 1],
             divider='Inset')
         im = IconLeftWidget(icon='account')
         recent.add_widget(im)
         recent.size_hint_max_y = 2
         self.ids.recent.add_widget(recent)
Ejemplo n.º 4
0
    def __init__(self, **kwargs):
        super(Mainnavscreen, self).__init__(**kwargs)

        global Mdnavigationdrawer
        navigationLayout = NavigationLayout()
        Containor = ScreenManager()
        Containor.add_widget(Main())
        navigationLayout.add_widget(Containor)

        Mdnavigationdrawer = MDNavigationDrawer()
        box = BoxLayout(orientation='vertical')
        box.add_widget(
            Button(background_normal="Pictures/banner.webp",
                   size_hint=(1, None),
                   size=(0, Window.height * 0.5)))
        Drawer_list = {
            "star": "Starred",
            "settings": "Settings",
            "bookmark": "Rate & Share"
        }
        for i, j in Drawer_list.items():
            Item = TwoLineIconListItem(text=str(j))
            Item.add_widget(IconLeftWidget(icon=str(i)))
            Item.bind(on_release=self.list_action)
            box.add_widget(Item)
        box.add_widget(ScrollView())
        Mdnavigationdrawer.add_widget(box)

        navigationLayout.add_widget(Mdnavigationdrawer)

        self.add_widget(navigationLayout)
Ejemplo n.º 5
0
 def display_client(self, customers):
     """method to add the current client as a widget in the view part"""
     #set of the customers list as a generator
     customers = (customer for customer in customers)
     for customer in customers:
         self.ids.box.add_widget(
             TwoLineIconListItem(
                 text='[b]' + customer[1] + '[/b]',
                 secondary_text=str(customer[2]),
                 id=str(customer[2]),
                 on_press=self.detail
             )  #.add_widget(IconLeftSampleWidget(icon='account-card-details'))
         )
Ejemplo n.º 6
0
    def client(self):
        """the principal method for the adding client into the data file """
        #get of the client input information by the widget id
        name = self.ids.name.text.strip().lower()
        motif = self.ids.motif.text.strip().lower()
        #get of a adminstrator(register id)
        administrator_id = self.manager.administrator[0]
        #set the markup of the phone number textfield to True
        self.ids.phone_number.markup = True
        number = self.ids.phone_number.text

        #get of the differents condition of the validation of the client adding
        name_condition = (not name.isspace()) and len(name) != 0
        motif_condition = (not motif.isspace()) and len(motif) != 0
        number_condition = not number.isspace()
        if motif_condition and name_condition and number_condition:
            if (not number.isdigit()) or (not len(number) == 8):
                self.ids.error_message.text = '[color=ff0033]invalide phone number[/color]'
            else:
                #client = Register(name, motif, phone_number)
                #instruction to do if the client exists in the data file
                if self.database.customer_exists(number):
                    self.ids.error_message.text = '[color=ff0033]Client exist[/color]'

                    self.database.set_data(name, motif, number,
                                           administrator_id)
                #saving insctruction
                else:

                    self.database.set_data(name, motif, number,
                                           administrator_id)
                    #saving message
                    self.ids.error_message.text = '[color=00ff33]Save successully![/color]'
                    customer = self.database.get_customer_by_number(number)
                    #add as widget in the application
                    self.ids.box.add_widget(
                        TwoLineIconListItem(text='[b]' + name + '[/b]',
                                            secondary_text=number,
                                            id=str(customer[2]),
                                            on_press=self.detail))
                    #saving in the data file

                #add as widget in the application
                #delete the current input after the save
                self.ids.name.text = ''
                self.ids.motif.text = ''
                self.ids.phone_number.text = ''

        #instruction for an invalid input
        else:
            self.ids.error_message.text = '[color=ff0033]Invalid input[/color]'
Ejemplo n.º 7
0
    def display_expenses(self, expenses):
        """method to add the current expense as a widget in the view part"""

        #set of the expenses list as a generator
        expenses = (expense for expense in expenses)
        for expense in expenses:
            self.ids.expense.add_widget(
                TwoLineIconListItem(
                    text=f'[b]{expense[1]}$[/b] ',
                    secondary_text=f'{expense[2]}',
                    secondary_font_style='Subtitle2',

                    )#.add_widget(IconLeftSampleWidget(icon='account-card-details'))
            )
Ejemplo n.º 8
0
 def display_sell_products(self, products):
     """method to add the current sell products as a widget in the view part"""
     #display the sell products total price
     self.display_sell_products_total_price()
     #set of the sell products list as a generator
     self.ids.sell_products_scroll.clear_widgets()
     products = (product for product in products)
     for product in products:
         self.ids.sell_products_scroll.add_widget(
             TwoLineIconListItem(
                 id=str(product[0]),
                 text=f'{product[5]}- [b]{product[1]}[/b] ',
                 secondary_text=f'{product[2]}$\n    {product[3]}$',
                 secondary_font_style='Subtitle2',
                 )
         )
Ejemplo n.º 9
0
    def display_products(self, products):
        """method to add the current client as a widget in the view part"""

        #set of the remaining product list as a generator
        products = (product for product in products)
        for product in products:
            self.ids.product.add_widget(
                TwoLineIconListItem(
                    id=str(product[0]),
                    text=f'[b]{product[1]}[/b] ',
                    secondary_text=f'{product[2]}$\n    {product[3]}$',
                    secondary_font_style='Subtitle2',
                    on_press=self.show_example_bottom_sheet,

                    )
            )
Ejemplo n.º 10
0
 def load_activity_page(self):
     ContentNavigationDrawer.populateNavDrawerValues(self)
     self.ids['actscroll'].clear_widgets()
     query = f'''SELECT ACTIVITY_ID, ORG_ID, NAME, LOCATION, DISASTER, TARGET_AMT FROM ACTIVITY WHERE 
     ORG_ID = {globalvariables.var_org_id} AND STATUS='Y' '''
     # run direct SQL
     print(globalvariables.var_org_id)
     stmt = ibm_db.exec_immediate(connection.conn, query)
     actlist = ibm_db.fetch_both(stmt)
     item = TwoLineIconListItem()
     while (actlist):
         icon = IconLeftWidget(icon="bank")
         item = TwoLineIconListItem(text=str(actlist[2]),
                                    secondary_text=str(actlist[3]))
         item.add_widget(icon)
         item.bind(on_release=self.row_press)
         self.ids['actscroll'].add_widget(item)
         actlist = ibm_db.fetch_both(
             stmt)  #for incrementing rows inside while loop
Ejemplo n.º 11
0
    def save_expense(self):
        #get of the expense price and his description
        price = self.ids.expense_name.text
        description = self.ids.expense_description.text
        #reset the textinput
        self.ids.expense_name.text = ''
        self.ids.expense_description.text = ''
        #saving of the expense into the database
        self.database.set_expense(price=price, description=description)
        #add of the expense in the widget
        self.ids.expense.add_widget(
            TwoLineIconListItem(
                text=f'[b]{price}$[/b] ',
                secondary_text=f'{description}',
                secondary_font_style='Subtitle2',


                )#.add_widget(IconLeftSampleWidget(icon='account-card-details'))
        )
        #reload of the total expense price
        self.display_total_expense_price()
Ejemplo n.º 12
0
    def __init__(self, **kwargs):
        super(Index, self).__init__(**kwargs)

        view = ScrollView()
        layout = GridLayout(cols=1,
                            padding=Window.height * 0.01,
                            spacing=Window.height * 0.05,
                            size_hint_y=None)
        layout.bind(minimum_height=layout.setter("height"))

        for i in labels:
            s = i
            s_ = []
            for ss in range(len(s)):
                if ss == 1:

                    s_.append('.' + s[ss])
                else:
                    s_.append(s[ss])
            s_ = ''.join(s_)

            A_ = A.split('\n')

            for m in A_:
                if s_ in m:
                    m = m.split(s_)[1]
                    j = len(m)
                    size_x = j * Window.height * 0.042 / 2.25
                    if Window.width > size_x:
                        size_x = Window.width
                    btn = Cbutton(lts=i,
                                  font_name="kannada_mallige",
                                  text="[font=Roboto-Bold][b][size=" +
                                  str(int(Window.height * 0.05)) + ']' +
                                  str(i) + '. ' + '[/size][/b][/font]' + m +
                                  "[font=Roboto-Bold][b][size=" +
                                  str(int(Window.height * 0.05)) + ']' +
                                  '.... ' + '[/size][/b][/font]',
                                  markup=True,
                                  size=(size_x, Window.height * 0.06),
                                  font_size=(Window.height * 0.04),
                                  background_color=(1, 1, 1, 0),
                                  size_hint=(None, None),
                                  halign='left',
                                  valign='center',
                                  pos=(0, Window.height - 100),
                                  color=(0, 0, 0, 1))
                    btn.bind(on_release=self.Screens_2)
                    layout.add_widget(btn)
                    break

        view.add_widget(layout)

        box = BoxLayout(orientation='vertical')
        toolbar = TwoLineIconListItem(bg_color=(0, .588, .533, 1))
        back_icon = IconLeftWidget(icon='arrow-left-thick')

        back_icon.bind(on_release=self.back)

        toolbar.add_widget(back_icon)

        box.add_widget(toolbar)

        box.add_widget(view)
        self.add_widget(box)
Ejemplo n.º 13
0
    def __init__(self, **kwargs):
        super(setting, self).__init__(**kwargs)
        box = BoxLayout(orientation="vertical")

        toolbar = TwoLineIconListItem(bg_color=(0, .588, .533, 1))
        back_icon = IconLeftWidget(icon='arrow-left-thick')

        back_icon.bind(on_release=self.back)

        toolbar.add_widget(back_icon)

        box.add_widget(toolbar)
        item = TwoLineIconListItem(
            text="Theme Style",
            secondary_text='Change the screen to Dark or light')
        item.add_widget(IconLeftWidget(icon="moon-waning-crescent"))
        item.bind(on_release=self.darkmode)
        box.add_widget(item)

        item1 = TwoLineIconListItem(
            text="Bold Format",
            secondary_text='Change the font to bold or normal')
        item1.add_widget(IconLeftWidget(icon="format-bold"))
        item1.bind(on_release=self.Bold)
        box.add_widget(item1)

        item2 = TwoLineIconListItem(
            text="Index lines", secondary_text='Change index lines to 3 or 1')
        item2.add_widget(IconLeftWidget(icon="layers"))
        item2.bind(on_release=self.Lines)
        box.add_widget(item2)
        box.add_widget(ScrollView())
        self.add_widget(box)
Ejemplo n.º 14
0
    def __init__(self, letter, **kwargs):
        super(Main_2, self).__init__(**kwargs)

        if len(letter) == 2:
            z = str(letter[0]) + '.' + str(letter[1])
            y = str(letter[0]) + '.' + str(int(letter[1]) + 1)
        elif len(letter) == 3:
            z = str(letter[0]) + '.' + str(letter[1]) + str(letter[2])
            y = str(letter[0]) + '.' + str(
                int(str(letter[1]) + str(letter[2])) + 1)
        string = A.split(z)[1].split(y)[0]
        string1 = []
        for i in string:
            if i != '\t':
                string1.append(i)
        a = ''.join(string1)

        boldness = bold

        x = []
        for i in range(len(a)):
            if a[i].isdecimal() and a[i + 1] != ')':
                x.append('\n' + a[i])
            else:
                x.append(a[i])

        x = ''.join(x)

        m = x.split('\n')
        n = []
        j = 0
        for i in m:
            if len(i) >= j:
                j = len(i)
        size_y = Window.height * 0.043 * (len(m) + 5)
        size_x = j * Window.height * 0.045 / 2.25
        if Window.width > size_x:
            size_x = Window.width
        btn = Label(font_name="kannada_mallige",
                    text="[font=Roboto-Bold][b][size=" +
                    str(int(Window.height * 0.05)) + ']' + str(letter) + '. ' +
                    '[/size][/b][/font]' + x,
                    size=(size_x, size_y),
                    font_size=(Window.height * 0.04),
                    text_size=(None, None),
                    bold=boldness,
                    markup=True,
                    size_hint=(None, None),
                    halign='left',
                    valign='top',
                    color=(0, 0, 0, 1))

        root = ScrollView(size_hint=(1, 1))
        root.add_widget(btn)
        box = BoxLayout(orientation='vertical')
        toolbar = TwoLineIconListItem(bg_color=(0, .588, .533, 1))
        back_icon = IconLeftWidget(icon='arrow-left-thick')

        back_icon.bind(on_release=self.back)

        toolbar.add_widget(back_icon)

        box.add_widget(toolbar)
        box.add_widget(root)
        self.add_widget(box)

        star = MDIconButton(icon="star-outline",
                            pos_hint={
                                'right': 1,
                                'top': 1
                            })
        star.bind(on_release=self.bookmark)
        self.add_widget(star)
Ejemplo n.º 15
0
    def __init__(self, Letter, **kwargs):
        super(Main_1, self).__init__(**kwargs)
        if line == False:
            lines = 1
            sp = 0.015
        elif line == True:
            lines = 3
            sp = 0.02
        view = ScrollView()
        layout = GridLayout(cols=1,
                            padding=Window.height * sp,
                            spacing=Window.height * sp,
                            size_hint_y=None)
        layout.bind(minimum_height=layout.setter("height"))

        for i in range(X[str(Letter)]):
            no = i
            letter = Letter + str(i + 1)
            if len(letter) == 2:
                z = str(letter[0]) + '.' + str(letter[1])
                y = str(letter[0]) + '.' + str(int(letter[1]) + 1)
            elif len(letter) == 3:
                z = str(letter[0]) + '.' + str(letter[1]) + str(letter[2])
                y = str(letter[0]) + '.' + str(
                    int(str(letter[1]) + str(letter[2])) + 1)
            string = A.split(z)[1].split(y)[0]
            string1 = []
            for i in string:
                if i != '\t':
                    string1.append(i)
            x = ''.join(string1)

            m = x.split('\n')
            x = '\n'.join(m[0:lines])
            m = x.split('\n')
            n = []
            j = 0
            for i in m:
                if len(i) >= j:
                    j = len(i)

            size_y = Window.height * 0.05 * (len(m))
            size_x = j * Window.height * 0.042 / 2.25
            if Window.width > size_x:
                size_x = Window.width
            btn = Cbutton(lts=letter,
                          font_name="kannada_mallige",
                          text="[font=Roboto-Bold][b][size=" +
                          str(int(Window.height * 0.05)) + ']' + str(letter) +
                          '. ' + '[/size][/b][/font]' + x +
                          "[font=Roboto-Bold][b][size=" +
                          str(int(Window.height * 0.05)) + ']' + ' ' +
                          '[/size][/b][/font]',
                          bold=True,
                          markup=True,
                          size=(size_x, size_y),
                          font_size=(Window.height * 0.04),
                          background_color=(1, 1, 1, 0),
                          size_hint=(None, None),
                          halign='left',
                          valign='center',
                          pos=(0, Window.height - 100),
                          color=(0, 0, 0, 1))
            btn.bind(on_release=self.Screens_2)

            layout.add_widget(btn)

        view.add_widget(layout)

        box = BoxLayout(orientation='vertical')
        toolbar = TwoLineIconListItem(bg_color=(0, .588, .533, 1))
        back_icon = IconLeftWidget(icon='arrow-left-thick')

        back_icon.bind(on_release=self.back)

        toolbar.add_widget(back_icon)

        box.add_widget(toolbar)

        box.add_widget(view)
        self.add_widget(box)
Ejemplo n.º 16
0
    def __init__(self, **kwargs):
        super(Starred, self).__init__(**kwargs)

        view = ScrollView()
        layout = GridLayout(cols=1,
                            padding=Window.height * 0.01,
                            spacing=Window.height * 0.01,
                            size_hint_y=None)
        layout.bind(minimum_height=layout.setter("height"))

        for i in Star:
            letter = i
            if len(letter) == 2:
                z = str(letter[0]) + '.' + str(letter[1])
                y = str(letter[0]) + '.' + str(int(letter[1]) + 1)
            elif len(letter) == 3:
                z = str(letter[0]) + '.' + str(letter[1]) + str(letter[2])
                y = str(letter[0]) + '.' + str(
                    int(str(letter[1]) + str(letter[2])) + 1)
            string = A.split(z)[1].split(y)[0]
            string1 = []
            for i in string:
                if i != '\t':
                    string1.append(i)
            a = ''.join(string1)

            x = []
            for i in range(len(a)):
                if a[i].isdecimal() and a[i + 1] != ')':
                    x.append('\n' + a[i])
                else:
                    x.append(a[i])
            x = ''.join(x)

            m = x.split('\n')
            x = '\n'.join(m[0:6])
            m = x.split('\n')
            n = []
            j = 0
            for i in m:
                if len(i) >= j:
                    j = len(i)

            size_y = Window.height * 0.05 * (len(m))
            size_x = j * Window.height * 0.042 / 2.25
            if Window.width > size_x:
                size_x = Window.width
            btn = Button(id=letter,
                         font_name="kannada_mallige",
                         text="[font=Roboto-Bold][b][size=" +
                         str(int(Window.height * 0.05)) + ']' + str(letter) +
                         '. ' + '[/size][/b][/font]' + x,
                         size=(size_x, size_y),
                         font_size=(Window.height * 0.04),
                         text_size=(None, None),
                         markup=True,
                         background_color=(1, 1, 1, 0),
                         size_hint=(None, None),
                         halign='left',
                         valign='center',
                         pos=(0, Window.height - 100),
                         color=(0, 0, 0, 1))  # valign = 'top')
            btn.bind(on_release=self.Screens_2)

            layout.add_widget(btn)

        view.add_widget(layout)

        box = BoxLayout(orientation='vertical')
        toolbar = TwoLineIconListItem(bg_color=(0, .588, .533, 1))
        back_icon = IconLeftWidget(icon='arrow-left-thick')

        back_icon.bind(on_release=self.back)

        toolbar.add_widget(back_icon)

        box.add_widget(toolbar)

        box.add_widget(view)
        self.add_widget(box)