def __init__(self):
        super(Test, self).__init__()

        self.click_tracker = 0

        self.main_screen = MDScreen()

        self.cust_button = MDFillRoundFlatIconButton(
            text="MDRAISEDBUTTON",
            md_bg_color=(1, 0, 1, 1),
            #size_hint=(None, None),
            #size=(300, 300),
            pos_hint={'center_x':0.5, 'center_y':0.5},
            font_size=dp(16),
            on_press=self.cust_button_func
        )


        self.cust_spinner = MDSpinner(
            size_hint=(None, None),
            size=(dp(28), dp(28)),
            #pos_hint={'center_x':0.1, 'center_y':0.1},
            active=True,
            line_width=3,
            palette=[
                [0.28627450980392155, 0.8431372549019608, 0.596078431372549, 1],
                [0.3568627450980392, 0.3215686274509804, 0.8666666666666667, 1],
                [0.8862745098039215, 0.36470588235294116, 0.592156862745098, 1],
                [0.8784313725490196, 0.9058823529411765, 0.40784313725490196, 1],
            ]
        )

        self.cust_button.add_widget(self.cust_spinner)

        self.main_screen.add_widget(self.cust_button)
Example #2
0
 def masters_ok(self):
     """Checks if master passwords are OK."""
     if not check_beta():
         alert_dialog = MDDialog(
             title='Missing beta password',
             text='I\'ve noticed, that you have not set beta password. It\'s needed for safe password storing.'
                  ' Do you want to provide it by yourself, or let program to randomize it?',
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text='Set password',
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(alert_dialog, 'settings')
                 ),
                 MDRoundFlatIconButton(
                     text='Randomize',
                     icon='dice-multiple-outline',
                     on_release=lambda x: [
                         self.reset_beta(),
                         alert_dialog.dismiss()
                     ]
                 )
             ]
         )
         alert_dialog.open()
         return False
     elif not check_alpha():
         alert_dialog = MDDialog(
             title='Missing alpha password',
             text='I\'ve noticed, that you have not set alpha password. It\'s needed for safe password storing.'
                  ' Do you want to provide it by yourself, or let program to randomize it?',
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text='Set password',
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(alert_dialog, 'settings')
                 ),
                 MDRoundFlatIconButton(
                     text='Randomize',
                     icon='dice-multiple-outline',
                     on_release=lambda x: [
                         self.reset_alpha(),
                         alert_dialog.dismiss()
                     ]
                 )
             ]
         )
         alert_dialog.open()
         return False
     else:
         return True
Example #3
0
 def _verify_dialog(self):
     content_cls = BoxLayout()
     content_cls.add_widget(MDTextField(
         hint_text=self.tr(
             'alpha'
         ).capitalize() + ' ' + self.tr(
             'password'
         ).lower()
     ))
     alert_dialog = MDDialog(
         title=self.tr('confirm_alpha'),
         type='custom',
         auto_dismiss=False,
         content_cls=content_cls,
         buttons=[
             MDFillRoundFlatIconButton(
                 text=self.tr('ok'),
                 on_release=lambda x: [
                     alert_dialog.dismiss(),
                     self.set_confirm(
                         alert_dialog.content_cls.children[0].text
                     ),
                     self._confirm_done()
                 ]
             ),
             MDRoundFlatIconButton(
                 text=self.tr('cancel'),
                 on_release=lambda x: [
                     alert_dialog.dismiss()
                 ]
             )
         ]
     )
     return alert_dialog
Example #4
0
 def masters_ok(self):
     """Checks if master passwords are OK."""
     if not check_beta():
         alert_dialog = MDDialog(
             title=self.tr('error_missing_master_title',
                           txt_format=self.tr('beta')),
             text=self.tr('error_missing_master_text'),
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text=self.tr('set_password'),
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(
                         alert_dialog, 'settings')),
                 MDRoundFlatIconButton(
                     text=self.tr('randomize'),
                     icon='dice-multiple-outline',
                     on_release=lambda x:
                     [self.reset_beta(),
                      alert_dialog.dismiss()])
             ])
         alert_dialog.open()
         return False
     elif not check_alpha():
         alert_dialog = MDDialog(
             title=self.tr('error_missing_master_title',
                           txt_format=self.tr('alpha')),
             text=self.tr('error_missing_master_text'),
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text=self.tr('set_password'),
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(
                         alert_dialog, 'settings')),
                 MDRoundFlatIconButton(
                     text=self.tr('randomize'),
                     icon='dice-multiple-outline',
                     on_release=lambda x:
                     [self.reset_alpha(),
                      alert_dialog.dismiss()])
             ])
         alert_dialog.open()
         return False
     else:
         return True
Example #5
0
 def del_password(self, password=None, force=False):
     if password is None:
         password = self.root.ids.del_password_alias.text.capitalize()
     self.root.ids.del_password_alias.text = ''
     if not force and len(password) == 0:
         result_dialog = SimpleDialog(
             title=self.tr('whoops'),
             text=self.tr('error_no_alias'),
             alert_text=self.tr('ok')
         ).alert()
     elif not force and len(password) < 3:
         result_dialog = SimpleDialog(
             title=self.tr('whoops'),
             text=self.tr('error_alias_too_short', txt_format='3'),
             alert_text=self.tr('ok')
         ).alert()
     else:
         to_del = get_one_password(password)
         if to_del is None:
             result_dialog = SimpleDialog(
                 title=self.tr('warning'),
                 text=self.tr('error_not_exists'),
                 alert_text=self.tr('ok')
             ).alert()
         elif type(to_del) is not bytes:
             result_dialog = SimpleDialog(
                 title=self.tr('warning'),
                 text=self.tr('error_bad_format'),
                 alert_text=self.tr('ok')
             ).alert()
         else:
             result_dialog = MDDialog(
                 title=self.tr('warning'),
                 text=self.tr('confirm_delete', txt_format=password),
                 auto_dismiss=False,
                 buttons=[
                     MDFillRoundFlatIconButton(
                         text=self.tr('yes'),
                         icon='check-circle-outline',
                         on_release=lambda x: [
                             self._del_password_confirm(password),
                             result_dialog.dismiss()
                         ]
                     ),
                     MDRoundFlatIconButton(
                         text=self.tr('no'),
                         icon='close-circle-outline',
                         on_release=lambda x: self.dismiss_and_back(
                             result_dialog
                         )
                     )
                 ]
             )
     result_dialog.open()
Example #6
0
 def confirm2(self):
     if not self.confirmd2:
         self.confirmd2 = MDDialog(
             title='[color=#FFFFFF]Confirm[/color]',
             size_hint=(0.4, 0.3),
             text="{},{}".format(self.my_event, self.starttime),
             buttons=[
                 MDFlatButton(text='Cancel',
                              on_release=self.clconfirmd2,
                              text_color=self.theme_cls.primary_color),
                 MDFillRoundFlatIconButton(text='Ending Time',
                                           icon='clock',
                                           on_release=self.time_picker3)
             ])
         self.confirmd2.open()
Example #7
0
 def del_password(self, password=None):
     if password is None:
         password = self.root.ids.del_password_alias.text.capitalize()
     self.root.ids.del_password_alias.text = ''
     if len(password) == 0:
         result_dialog = SimpleDialog(
             title='Whoops!',
             text='Please provide password alias at first.'
         ).alert()
     elif len(password) < 3:
         result_dialog = SimpleDialog(
             title='Whoops!',
             text='Password alias has to be at least 3 characters long.'
         ).alert()
     else:
         to_del = get_one_password(password)
         if to_del is None:
             result_dialog = SimpleDialog(
                 title='Warning!',
                 text='That password do not exists in database'
             ).alert()
         elif type(to_del) is not bytes:
             result_dialog = SimpleDialog(
                 title='Warning!',
                 text='An critical error has occurred. Passwords are saved to local database in wrong way.'
             ).alert()
         else:
             result_dialog = MDDialog(
                 title='Attention',
                 text=f'Do you really want to delete "{password}" password?',
                 auto_dismiss=False,
                 buttons=[
                     MDFillRoundFlatIconButton(
                         text='Yes',
                         icon='check-circle-outline',
                         on_release=lambda x: [
                             self._del_password_confirm(password),
                             result_dialog.dismiss()
                         ]
                     ),
                     MDRoundFlatIconButton(
                         text='No',
                         icon='close-circle-outline',
                         on_release=lambda x: self.dismiss_and_back(result_dialog)
                     )
                 ]
             )
     result_dialog.open()
Example #8
0
    def __init__(self, **kw):
        super().__init__()
        self.pos_hint = {"x": .1, "y": .1}
        self.size_hint = .8, .8

        with self.canvas.before:
            Color(rgba=(0, .4, 0, 0.1))
            self.rect = RoundedRectangle(radius=[(20, 20)])
        self.bind(pos=self.update_rect, size=self.update_rect)

        self.name = MDLabel(text=kw["name"],
                            pos_hint={
                                "center_x": .5,
                                "top": .9
                            },
                            size_hint=(.5, .1),
                            font_style="H4",
                            halign="center")

        self.image = Image(pos_hint={
            "center_x": .5,
            "center_y": .5
        },
                           size_hint=(.5, .5),
                           source=kw["source"])

        self.add_button = MDFillRoundFlatIconButton(
            pos_hint={
                "right": 1,
                "y": 0
            },
            text="Añadir a Contactos",
            icon="account-plus",
            on_release=kw["add_button_action"])

        self.delete_button = MDIconButton(icon="close",
                                          pos_hint={
                                              "x": 0,
                                              "top": 1
                                          },
                                          on_release=kw["on_release"])

        self.add_widget(self.name)
        self.add_widget(self.image)
        self.add_widget(self.add_button)
        self.add_widget(self.delete_button)
Example #9
0
    def __init__(self, **kwargs):
        super().__init__()
        self.pos_hint = {"x": .05, "y": .05}
        self.size_hint = .9, .9

        with self.canvas.before:
            Color(rgba=(0, .4, 0, 0.1))
            self.rect = RoundedRectangle(radius=[(20, 20)])
        self.bind(pos=self.update_rect, size=self.update_rect)

        self.titulo = MDLabel(text=kwargs["titulo"],
                              pos_hint={
                                  "center_x": .5,
                                  "top": .99
                              },
                              size_hint=(.5, .1),
                              font_style="H6",
                              halign='center')

        self.imagen = Image(pos_hint={
            "center_x": .5,
            "y": .0
        },
                            size_hint=(.9, .9),
                            source=kwargs["source"])

        self.botongustar = MDFillRoundFlatIconButton(
            pos_hint={
                "x": .05,
                "y": .05
            },
            text="Útil",
            icon="heart",
            #on_release = print("Hola")
        )

        self.botoncerrar = MDIconButton(pos_hint={
            "right": 1,
            "top": 1
        },
                                        icon="close",
                                        on_release=kwargs["on_release"])

        self.add_widget(self.titulo)
        self.add_widget(self.imagen)
Example #10
0
    def addM(self):
        #self.time_dialog=MDTimePicker()
        if not self.cstm_evnt2:
            self.cstm_evnt2 = MDDialog(
                title='[color=#FFFFFF]Add Meeting[/color]',
                type='custom',
                content_cls=custom_events2(),
                size_hint=(0.4, 0.3),
                buttons=[
                    MDFlatButton(text='CANCEL',
                                 on_release=self.cstm_evnt_close2,
                                 text_color=self.theme_cls.primary_color),
                    MDFillRoundFlatIconButton(text='Starting Time',
                                              icon='clock',
                                              on_release=self.time_picker2)
                ])

        self.cstm_evnt2.open()
Example #11
0
 def reset_beta(self):
     confirm_dialog = MDDialog(
         title=self.tr('warning'),
         text=self.tr('confirm_randomize_beta'),
         auto_dismiss=False,
         buttons=[
             MDFillRoundFlatIconButton(
                 text=self.tr('yes'),
                 icon='check-circle-outline',
                 on_release=lambda x: [
                     self.change_master('beta', urandom(16)),
                     confirm_dialog.dismiss()
                 ]),
             MDRoundFlatIconButton(
                 text=self.tr('no'),
                 icon='close-circle-outline',
                 on_release=lambda x: confirm_dialog.dismiss())
         ])
     confirm_dialog.open()
Example #12
0
 def reset_beta(self):
     confirm_dialog = MDDialog(
         title='Warning!',
         text='This will randomize beta password. It will be super safe, but you probably will not be able to'
              ' re-enter this password later. Do you want to continue?',
         auto_dismiss=False,
         buttons=[
             MDFillRoundFlatIconButton(
                 icon='check-circle-outline',
                 text='Yes',
                 on_release=lambda x: [
                     self.change_master('beta', urandom(16)),
                     confirm_dialog.dismiss()
                 ]
             ),
             MDRoundFlatIconButton(
                 icon='close-circle-outline',
                 text='No',
                 on_release=lambda x: confirm_dialog.dismiss()
             )
         ]
     )
     confirm_dialog.open()
Example #13
0
 def load_txn_page(self):
     ContentNavigationDrawer.populateNavDrawerValues(self)
     query = f'''SELECT TXN_DATE, ORG.NAME as ORG_NAME, ACT.NAME as ACT_NAME, TXN.AMOUNT
     FROM TRANSACTION TXN, ACTIVITY ACT, ORG ORG
     WHERE TXN.CONTACT_ID={globalvariables.var_userid}
     AND TXN.ACTIVITY_ID = ACT.ACTIVITY_ID
     AND ACT.ORG_ID=ORG.ORG_ID ORDER BY TXN_DATE DESC'''
     # run direct SQL
     stmt = ibm_db.exec_immediate(connection.conn, query)
     txnlist = ibm_db.fetch_both(stmt)
     if txnlist is False :
         warn_label = MDLabel(pos_hint = {'center_x':0.5, 'center_y':0.5},font_size = '10sp',
         text = "You have not made any donations yet")
         self.ids['float_lay'].add_widget(warn_label)
     else:
         print(txnlist)
         tlist=[]
         while(txnlist):
             tlist.append([str(txnlist[0]),txnlist[1],txnlist[2],str(txnlist[3])])
             txnlist = ibm_db.fetch_both(stmt)
         data_tables = MDDataTable(
             size_hint=(0.8, 0.8),
             rows_num=100,
             background_color=[1,0,0,1],
             pos_hint = {'center_x':0.5, 'center_y':0.5},
             column_data=[
                 ("Date", dp(50)),
                 ("Group", dp(50)),
                 ("Activity", dp(50)),
                 ("Amount", dp(30)),
             ],
             row_data=[(f"{i[0]}",f"{i[1]}",f"{i[2]}",f"{i[3]}") for i in tlist]
             )
         self.ids['float_lay'].add_widget(data_tables)
         self.ids['float_lay'].add_widget(MDFillRoundFlatIconButton(text="BACK",
         pos_hint={'center_x':0.5, 'center_y':0.1}, icon="arrow-left-bold-circle",theme_text_color="Custom", 
         text_color= (0, 0, 1, 1), on_release=lambda x: self.to_home_page() ))
Example #14
0
 def __init__(self, *args, **kwargs):
     super(Persons, self).__init__(orientation="vertical")
     # Globální proměnná - obsahuje kontext aplikace
     global app
     app = App.get_running_app()
     # Vytvoření rolovacího seznamu
     scrollview = ScrollView()
     self.list = MDList()
     # Volání metody, která načte seznam osob ze souboru JSON
     self.person_list = self.read()
     # Volání metody, která načte přepíše seznam osob na obrazovku
     self.rewrite_list()
     scrollview.add_widget(self.list)
     self.add_widget(scrollview)
     # Přidání tlačítka pro vložení nového záznamu
     self.add_widget(
         MDFillRoundFlatIconButton(text="Nový záznam",
                                   icon="plus",
                                   icon_color=[0.9, 0.9, 0.9, 1],
                                   text_color=[0.9, 0.9, 0.9, 1],
                                   md_bg_color=[0, 0.5, 0.8, 1],
                                   font_style="Button",
                                   pos_hint={"center_x": .5},
                                   on_release=self.on_create))
Example #15
0
    def load_approval_page(self):
        ContentNavigationDrawer.populateNavDrawerValues(self)
        query = f'''SELECT MEMORG.NAME AS ONAME, NEWCON.FIRST_NAME||' '||NEWCON.LAST_NAME AS NAME, 
        NEWCON.EMAIL AS EMAIL
        FROM CONTACT NEWCON, CONTACT_ORG CONORG, 
        CONTACT_ORG MEMCON, ORG MEMORG
        WHERE NEWCON.CONTACT_ID = CONORG.CONTACT_ID
        AND CONORG.STATUS='N' AND CONORG.MEMBER_FLAG='P'
        AND MEMORG.ORG_ID = CONORG.ORG_ID
        AND CONORG.ORG_ID = MEMCON.ORG_ID
        AND MEMCON.CONTACT_ID={globalvariables.var_userid}
        AND MEMCON.STATUS='Y'
        AND MEMCON.MEMBER_FLAG='Y' '''
        # run direct SQL
        stmt = ibm_db.exec_immediate(connection.conn, query)
        txnlist = ibm_db.fetch_both(stmt)
        if txnlist is False:
            warn_label = MDLabel(pos_hint={
                'center_x': 0.5,
                'center_y': 0.5
            },
                                 font_size='10sp',
                                 text="You do not have any approvals")
            self.ids['approval_float_lay'].add_widget(warn_label)
        else:
            print(txnlist)
            alist = []
            while (txnlist):
                alist.append([str(txnlist[0]), txnlist[1], txnlist[2]])
                txnlist = ibm_db.fetch_both(stmt)
            data_tables = MDDataTable(size_hint=(1, 1),
                                      rows_num=100,
                                      check=True,
                                      pos_hint={
                                          'center_x': 0.5,
                                          'center_y': 0.5
                                      },
                                      column_data=[
                                          ("Group", dp(40)),
                                          ("Name", dp(40)),
                                          ("Email", dp(40)),
                                      ],
                                      row_data=[(f"{i[0]}", f"{i[1]}",
                                                 f"{i[2]}") for i in alist])
            data_tables.bind(on_check_press=self.on_check_press)
            self.ids['approval_float_lay'].add_widget(data_tables)
            #Approve Button
            approve_button = MDFillRoundFlatIconButton(
                text="APPROVE",
                pos_hint={
                    'center_x': 0.3,
                    'center_y': 0.2
                },
                icon="thumb-up-outline",
                on_release=lambda x: self.approvereq())
            approve_button.md_bg_color = 0.211, 0.678, 0.054, 1  #Green color
            self.ids['approval_float_lay'].add_widget(approve_button)
            #Reject Button
            reject_button = MDFillRoundFlatIconButton(
                text="REJECT",
                pos_hint={
                    'center_x': 0.7,
                    'center_y': 0.2
                },
                icon="thumb-down-outline",
                on_release=lambda x: self.rejectreq())
            reject_button.md_bg_color = 0.858, 0.239, 0.086, 1  #Red color
            self.ids['approval_float_lay'].add_widget(reject_button)

            self.ids['approval_float_lay'].add_widget(
                MDFillRoundFlatIconButton(
                    text="BACK",
                    pos_hint={
                        'center_x': 0.5,
                        'center_y': 0.1
                    },
                    icon="arrow-left-bold-circle",
                    theme_text_color="Custom",
                    text_color=(0, 0, 1, 1),
                    on_release=lambda x: self.to_home_page()))
Example #16
0
    def build(self):
        screen_manager = ScreenManager()
        self.loaded_values = [
            1, 0, 0, 0, 0, 0
        ]  # round num, cp, primary obj, 1st secondary, 2nd secondary, 3rd secondary
        self.update_values()
        self.theme_cls.primary_palette = "Gray"
        self.theme_cls.primary_hue = "800"

        # Game counters screen and backgrgound color

        self.counters = Screen(name="Counters")
        self.change_bg_color()

        screen_manager.add_widget(self.counters)

        # SCROLLVIEW

        self.scroll = ScrollView()
        self.counters.add_widget(self.scroll)

        # MENU
        self.menu_button = MDIconButton(icon='format-color-fill',
                                        on_release=self.menu_open)
        self.menu_button.pos_hint = {'center_x': .9, 'center_y': .1}
        self.menu_button.md_bg_color = (1, 1, 1, 1)
        items = [{
            "text": "Ceramic White"
        }, {
            "text": "Loyal Angels Green"
        }, {
            "text": "Space Doggos Gray"
        }, {
            "text": "Codex Blue"
        }, {
            "text": "Vampire Angels Red"
        }, {
            "text": "Gray Nights"
        }, {
            "text": "Stubborn Fists Yellow"
        }]
        self.menu = MDDropdownMenu(caller=self.menu_button,
                                   items=items,
                                   callback=self.menu_callback,
                                   width_mult=5)
        self.counters.add_widget(self.menu_button)

        # MAIN GRID
        app_grid = GridLayout(cols=1, spacing=100, size_hint_y=None)
        app_grid.padding = [
            Window.width / 40, Window.height / 20, Window.width / 40,
            Window.height / 4
        ]  # [left,top,right,bottom]
        app_grid.bind(minimum_height=app_grid.setter('height'))
        self.scroll.add_widget(app_grid)

        # ROUND COUNTER

        round_parent_grid = MDGridLayout()
        round_parent_grid.cols = 1
        round_parent_grid.rows = 2
        round_parent_grid.adaptive_height = True

        round_label = MDLabel(text='Round number:')
        round_label.halign = 'center'
        round_parent_grid.add_widget(round_label)
        app_grid.add_widget(round_parent_grid)

        grid_round = GridLayout()
        grid_round.cols = 3

        increase_round = MDIconButton(icon="arrow-right-bold",
                                      on_press=self.increase_round)
        self.round_counter = MDLabel(text=str(self.loaded_values[0]))
        self.round_counter.halign = 'center'
        self.round_counter.valign = 'middle'
        decrease_round = MDIconButton(icon="arrow-left-bold",
                                      on_press=self.decrease_round)

        grid_round.add_widget(decrease_round)
        grid_round.add_widget(self.round_counter)
        grid_round.add_widget(increase_round)
        round_parent_grid.add_widget(grid_round)

        # COMMAND POINTS

        cp_parent_grid = MDGridLayout()
        cp_parent_grid.cols = 1
        cp_parent_grid.rows = 2
        cp_parent_grid.adaptive_height = True

        cp_label = MDLabel(text='Command Points Left:')
        cp_label.halign = 'center'
        cp_parent_grid.add_widget(cp_label)
        app_grid.add_widget(cp_parent_grid)

        grid_cp = MDGridLayout()
        grid_cp.cols = 3

        increase_cp = MDIconButton(icon="arrow-right-bold",
                                   on_press=self.increase_cp)
        self.cp_counter = MDLabel(text=str(self.loaded_values[1]))
        self.cp_counter.halign = 'center'
        self.cp_counter.valign = 'middle'
        decrease_cp = MDIconButton(icon="arrow-left-bold",
                                   on_press=self.decrease_cp)

        grid_cp.add_widget(decrease_cp)
        grid_cp.add_widget(self.cp_counter)
        grid_cp.add_widget(increase_cp)
        cp_parent_grid.add_widget(grid_cp)

        # VP PRIMARY

        prim_parent_grid = MDGridLayout()
        prim_parent_grid.cols = 1
        prim_parent_grid.rows = 2
        prim_parent_grid.adaptive_height = True

        prim_label = MDLabel(text='Primary Objective Points:')
        prim_label.halign = 'center'
        prim_parent_grid.add_widget(prim_label)
        app_grid.add_widget(prim_parent_grid)

        grid_prim = MDGridLayout()
        grid_prim.cols = 3

        increase_prim = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_prim)
        self.prim_counter = MDLabel(text=str(self.loaded_values[2]))
        self.prim_counter.halign = 'center'
        self.prim_counter.valign = 'middle'
        decrease_prim = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_prim)

        grid_prim.add_widget(decrease_prim)
        grid_prim.add_widget(self.prim_counter)
        grid_prim.add_widget(increase_prim)
        prim_parent_grid.add_widget(grid_prim)

        # VP SECONDARY 1

        sec1_parent_grid = MDGridLayout()
        sec1_parent_grid.cols = 1
        sec1_parent_grid.rows = 2
        sec1_parent_grid.adaptive_height = True

        sec1_label = MDTextField()
        sec1_label.hint_text = '1st Secondary Objective Points:'
        sec1_label.multiline = False
        #sec1_label = MDLabel(text='1st Secondary Objective Points:')
        sec1_label.halign = 'center'
        sec1_parent_grid.add_widget(sec1_label)
        app_grid.add_widget(sec1_parent_grid)

        grid_sec1 = MDGridLayout()
        grid_sec1.cols = 3

        increase_sec1 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec1)
        self.sec1_counter = MDLabel(text=str(self.loaded_values[3]))
        self.sec1_counter.halign = 'center'
        self.sec1_counter.valign = 'middle'
        decrease_sec1 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec1)

        grid_sec1.add_widget(decrease_sec1)
        grid_sec1.add_widget(self.sec1_counter)
        grid_sec1.add_widget(increase_sec1)
        sec1_parent_grid.add_widget(grid_sec1)

        # VP SECONDARY 2

        sec2_parent_grid = MDGridLayout()
        sec2_parent_grid.cols = 1
        sec2_parent_grid.rows = 2
        sec2_parent_grid.adaptive_height = True

        sec2_label = MDTextField()
        sec2_label.hint_text = '2nd Secondary Objective Points:'
        sec2_label.multiline = False
        #sec2_label = MDLabel(text='2nd Secondary Objective Points:')
        sec2_label.halign = 'center'
        sec2_parent_grid.add_widget(sec2_label)
        app_grid.add_widget(sec2_parent_grid)

        grid_sec2 = MDGridLayout()
        grid_sec2.cols = 3

        increase_sec2 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec2)
        self.sec2_counter = MDLabel(text=str(self.loaded_values[4]))
        self.sec2_counter.halign = 'center'
        self.sec2_counter.valign = 'middle'
        decrease_sec2 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec2)

        grid_sec2.add_widget(decrease_sec2)
        grid_sec2.add_widget(self.sec2_counter)
        grid_sec2.add_widget(increase_sec2)
        sec2_parent_grid.add_widget(grid_sec2)

        # VP SECONDARY 3

        sec3_parent_grid = MDGridLayout()
        sec3_parent_grid.cols = 1
        sec3_parent_grid.rows = 2
        sec3_parent_grid.adaptive_height = True

        sec3_label = MDTextField()
        sec3_label.hint_text = '3rd Secondary Objective Points:'
        sec3_label.multiline = False
        #sec3_label = MDLabel(text='3rd Secondary Objective Points:')
        sec3_label.halign = 'center'
        sec3_parent_grid.add_widget(sec3_label)
        app_grid.add_widget(sec3_parent_grid)

        grid_sec3 = MDGridLayout()
        grid_sec3.cols = 3

        increase_sec3 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec3)
        self.sec3_counter = MDLabel(text=str(self.loaded_values[5]))
        self.sec3_counter.halign = 'center'
        self.sec3_counter.valign = 'middle'
        decrease_sec3 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec3)

        grid_sec3.add_widget(decrease_sec3)
        grid_sec3.add_widget(self.sec3_counter)
        grid_sec3.add_widget(increase_sec3)
        sec3_parent_grid.add_widget(grid_sec3)

        # Empty grid to create space

        empty_grid = MDGridLayout()
        app_grid.add_widget(empty_grid)

        # Bottom grid for Score and Reset buttons

        bottom_grid = MDGridLayout()
        bottom_grid.cols = 2
        app_grid.add_widget(bottom_grid)

        # SCORE TOAST

        score_button = MDFillRoundFlatIconButton(icon='flag-plus-outline',
                                                 text="Show score",
                                                 on_press=self.sum_up)
        button_anchor = AnchorLayout()
        button_anchor.anchor_y = 'bottom'
        button_anchor.add_widget(score_button)
        bottom_grid.add_widget(button_anchor)

        # RESET

        reset_button = MDFillRoundFlatIconButton(icon='backup-restore',
                                                 text="Reset",
                                                 on_press=self.reset_values)
        reset_button_anchor = AnchorLayout()
        reset_button_anchor.anchor_y = 'bottom'
        reset_button_anchor.add_widget(reset_button)
        bottom_grid.add_widget(reset_button_anchor)

        return screen_manager
Example #17
0
    def __init__(self, *args, **kwargs):
        super(Books, self).__init__(orientation="vertical")
        global app
        app = App.get_running_app()
        scrollview = ScrollView()
        self.list = MDList()
        self.database = Db(dbtype='sqlite', dbname='books.db')
        self.rewrite_list()
        scrollview.add_widget(self.list)
        self.add_widget(scrollview)
        button_box = BoxLayout(orientation='horizontal', size_hint_y=0.1)
        new_book_btn = MDFillRoundFlatIconButton()
        new_book_btn.text = "Nová kniha"
        new_book_btn.icon = "plus"
        new_book_btn.icon_color = [0.9, 0.9, 0.9, 1]
        new_book_btn.text_color = [0.9, 0.9, 0.9, 1]
        new_book_btn.md_bg_color = [0, 0.5, 0.8, 1]
        new_book_btn.font_style = "Button"
        new_book_btn.pos_hint = {"center_x": .5}
        new_book_btn.on_release = self.on_create_book
        button_box.add_widget(new_book_btn)

        new_author_btn = MDFillRoundFlatIconButton()
        new_author_btn.text = "Nový autor"
        new_author_btn.icon = "plus"
        new_author_btn.icon_color = [0.9, 0.9, 0.9, 1]
        new_author_btn.text_color = [0.9, 0.9, 0.9, 1]
        new_author_btn.md_bg_color = [0.8, 0.5, 0, 1]
        new_author_btn.font_style = "Button"
        new_author_btn.pos_hint = {"center_x": .6}
        new_author_btn.on_release = self.on_create_author
        button_box.add_widget(new_author_btn)

        new_genre_btn = MDFillRoundFlatIconButton()
        new_genre_btn.text = "Nový žánr"
        new_genre_btn.icon = "plus"
        new_genre_btn.icon_color = [0.9, 0.9, 0.9, 1]
        new_genre_btn.text_color = [0.9, 0.9, 0.9, 1]
        new_genre_btn.md_bg_color = [0.8, 0.5, 0, 1]
        new_genre_btn.font_style = "Button"
        new_genre_btn.pos_hint = {"center_x": .6}
        new_genre_btn.on_release = self.on_create_genre
        button_box.add_widget(new_genre_btn)
        self.add_widget(button_box)
Example #18
0
    def __init__(self, **kwargs):
        self.nav_drawer = kwargs.pop('nav_drawer')
        self.app = kwargs.pop('app')
        self.micro_sim = kwargs.pop('micro_sim')
        self.dpi = kwargs.pop('dpi')
        super().__init__(**kwargs)
        self.buttons_y_pos = dp(0.2) if self.dpi < 192 else dp(0.1)

        self.first_inst = True
        self.step_assembly = False

        self.ids['left_actions'] = BoxLayout()
        self.orientation = 'vertical'
        self.toolbar_layout = BoxLayout(orientation='vertical')
        self.menu_items = [{
            "viewclass": "MDMenuItem",
            "text": "Save Register/Memory Content",
            "callback": self.open_reg_mem_save_dialog,
        }, {
            "viewclass": "MDMenuItem",
            "text": "Save Editor Content",
            "callback": self.open_editor_save_dialog
        }]
        self.run_window = RunWindow(app=self.app,
                                    micro_sim=self.micro_sim,
                                    dpi=self.dpi)
        self.md_toolbar = MDToolbar(
            title='Semref Micro Sim',
            md_bg_color=self.app.theme_cls.primary_color,
            background_palette='Primary',
            background_hue='500',
            elevation=10,
            ids=self.ids,
            left_action_items=[[
                'dots-vertical', lambda x: self.nav_drawer.toggle_nav_drawer()
            ]])
        self.run_button = MDFillRoundFlatIconButton(
            text='Run',
            icon='run',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.run_micro_instructions)
        self.debug_button = MDFillRoundFlatIconButton(
            text='Debug',
            icon='android-debug-bridge',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.run_micro_instructions_step)
        self.refresh_button = MDFillRoundFlatIconButton(
            text='Clear',
            icon='refresh',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.clear_dialog)
        self.save_button = MDFillRoundFlatIconButton(
            text='Save File',
            icon='download',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=lambda x: MDDropdownMenu(
                items=self.menu_items, width_mult=4).open(self.save_button))
        self.pop_button = MDFillRoundFlatIconButton(
            text='Hex Keyboard',
            icon='keyboard-outline',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.run_window.open_keyboard)
        self.loaded_file = MDIconButton(icon='file-check',
                                        size_hint=(None, None),
                                        pos_hint={'y': self.buttons_y_pos},
                                        theme_text_color='Custom',
                                        text_color=[0, 0.6, 0, 1],
                                        on_release=self.buttons_information)
        self.not_loaded_file = MDIconButton(
            icon='file-alert',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            theme_text_color='Custom',
            text_color=self.app.theme_cls.accent_dark,
            on_release=self.buttons_information)
        self.md_toolbar.add_widget(self.run_button)
        self.md_toolbar.add_widget(self.debug_button)
        self.md_toolbar.add_widget(self.refresh_button)
        self.md_toolbar.add_widget(self.save_button)
        self.md_toolbar.add_widget(self.pop_button)
        self.add_widget(self.md_toolbar)
        self.add_widget(self.run_window)
        self.add_widget(self.not_loaded_file)
Example #19
0
    def __init__(self, *args, **kwargs):
        super(Persons, self).__init__(orientation="vertical")
        global app
        app = App.get_running_app()
        scrollview = ScrollView()
        self.list = MDList()
        self.database = Db(dbtype='sqlite', dbname='persons.db')
        self.rewrite_list()
        scrollview.add_widget(self.list)
        self.add_widget(scrollview)
        button_box = BoxLayout(orientation='horizontal', size_hint_y=0.1)
        new_person_btn = MDFillRoundFlatIconButton()
        new_person_btn.text = "Nová osoba"
        new_person_btn.icon = "plus"
        new_person_btn.icon_color = [0.9, 0.9, 0.9, 1]
        new_person_btn.text_color = [0.9, 0.9, 0.9, 1]
        new_person_btn.md_bg_color = [0, 0.5, 0.8, 1]
        new_person_btn.font_style = "Button"
        new_person_btn.pos_hint = {"center_x": .5}
        new_person_btn.on_release = self.on_create_person
        button_box.add_widget(new_person_btn)

        new_state_btn = MDFillRoundFlatIconButton()
        new_state_btn.text = "Nový stát"
        new_state_btn.icon = "plus"
        new_state_btn.icon_color = [0.9, 0.9, 0.9, 1]
        new_state_btn.text_color = [0.9, 0.9, 0.9, 1]
        new_state_btn.md_bg_color = [0.8, 0.5, 0, 1]
        new_state_btn.font_style = "Button"
        new_state_btn.pos_hint = {"center_x": .6}
        new_state_btn.on_release = self.on_create_state
        button_box.add_widget(new_state_btn)

        new_city_btn = MDFillRoundFlatIconButton()
        new_city_btn.text = "Nové město"
        new_city_btn.icon = "plus"
        new_city_btn.icon_color = [0.9, 0.9, 0.9, 1]
        new_city_btn.text_color = [0.9, 0.9, 0.9, 1]
        new_city_btn.md_bg_color = [0.8, 0.5, 0.5, 1]
        new_city_btn.font_style = "Button"
        new_city_btn.pos_hint = {"center_x": 1}
        new_city_btn.on_release = self.on_create_city
        button_box.add_widget(new_city_btn)
        self.add_widget(button_box)