def build(self):
     root = Accordion()
     for x in xrange(5):
         item = AccordionItem(title='Title %d' % x)
         item.add_widget(Label(text='Very big content\n' * 10))
         root.add_widget(item)
     return root
Beispiel #2
0
    def __init__(self, username, userid, name):
        """

        """
        self.name = name
        self.username = username
        self.userid = userid
        super(LevelSelect, self).__init__()

        conn = sqlite3.connect(filehome + 'database.db')  # Opens the connection to the database.
        c = conn.cursor()
        levels = c.execute('''SELECT levelid, levelname, leveldesc FROM level''')  # Gets the levels from the database

        box = BoxLayout(orientation = 'vertical')
        box.add_widget(Banner(False, 2, self.userid))  # Adds the top banner, as this is the main menu we need a logout button and not a back button. 
        lvlAccordion = Accordion(orientation = 'vertical', min_space = dp(25), anim_duration = 1)
        for i in levels:
            item = AccordionItem(title = i[1], min_space = dp(25), background_normal='images/blue32025.png', background_selected='images/orange32025.png')    
            boxa = BoxLayout(orientation = 'vertical')
            lbl = Label(text = i[2], text_size = (300, None))
            boxa.add_widget(lbl)
            btn = Button(text = 'Go', id = str(i[0])+','+i[1], on_press = self.selectlevel, background_normal = 'images/orange32030.png', background_down = 'images/blue32025.png', size_hint_y = None, height = dp(30))
            boxa.add_widget(btn)
            item.add_widget(boxa)
            lvlAccordion.add_widget(item)
        box.add_widget(lvlAccordion)  # Adds the Accordion to the box
        self.add_widget(box)  # Adds the box widget to the screen
        conn.close()
    def __init__(self, **kwargs):
        self._buttons = {}

        super(PlaygroundSizeView, self).__init__(**kwargs)

        for title, values in self.default_sizes:
            grid = GridLayout(rows=4)

            def sort_sizes(item):
                return item[1][1] * item[1][0]

            values = sorted(values, key=sort_sizes, reverse=True)
            for name, size in values:
                btn = ToggleButton(text='', markup=True)
                btntext = ('%s\n[color=777777][size=%d]%dx%d[/size][/color]' %
                           (name, btn.font_size * 0.8, size[0], size[1]))
                btn.text = btntext
                btn.bind(on_press=partial(self.set_size, size))
                grid.add_widget(btn)
                self._buttons[name] = btn

            item = AccordionItem(title=title)
            item.add_widget(grid)
            self.accordion.add_widget(item)

        self.accordion.select(self.accordion.children[-1])

        self.update_buttons()
Beispiel #4
0
 def add_pages(self, day):
     self.clear_widgets()    
     a = AccordionItem(title='Basic Truths')
     self.rule_list = BoxLayout(orientation='vertical')
     a.add_widget(self.rule_list)
     self.add_rules(day)
     self.add_widget(a)
Beispiel #5
0
 def build(self):
     root =Accordion()
     for x in range(5):
         item = AccordionItem(title='Title %d'  %x , min_space=60)
         item.add_widget(Label(text='Hello Youssef \n' *5))
         root.add_widget(item)
     return root
    def __init__(self, **kwargs):
        self._buttons = {}

        super(PlaygroundSizeView, self).__init__(**kwargs)

        for title, values in self.default_sizes:
            grid = GridLayout(rows=4)

            def sort_sizes(item):
                return item[1][1] * item[1][0]

            values = sorted(values, key=sort_sizes, reverse=True)
            for name, size in values:
                btn = ToggleButton(text='', markup=True)
                btntext = ('%s\n[color=777777][size=%d]%dx%d[/size][/color]' %
                           (name, btn.font_size * 0.8, size[0], size[1]))
                btn.text = btntext
                btn.bind(on_press=partial(self.set_size, size))
                grid.add_widget(btn)
                self._buttons[name] = btn

            item = AccordionItem(title=title)
            item.add_widget(grid)
            self.accordion.add_widget(item)

        self.accordion.select(self.accordion.children[-1])

        self.update_buttons()
Beispiel #7
0
 def build(self):
     root = Accordion()
     for x in range(2):
         item = AccordionItem(title='Title %d' % x)    
         item.add_widget(Builder.load_string(kv))
         root.add_widget(item)
     return root   
Beispiel #8
0
 def build(self):
     root = Accordion()
     for x in xrange(5):
         item = AccordionItem(title='Title %d' % x)
         item.add_widget(Label(text='Very big content\n' * 10))
         root.add_widget(item)
     return root
Beispiel #9
0
class dice_UIRight(Accordion):
    """The right side of the interface, an accordion group"""
    def __init__(self, **kwargs):
        super(dice_UIRight, self).__init__(**kwargs)
        self.size_hint_x = .35
        self.orientation = "vertical"
        
        # Accordion Items
        self.historyAcc = AccordionItem(
            title = "History"
            )
        self.commonPoolsAcc = AccordionItem(
            title = "Common Dice Pools"
            )
        
        # Things inside of the Accordion Items
        self.commonPools = dice_CommonPools()
        self.history = dice_HistoryListView()
        
        # Add interior items to Accordion Items
        self.commonPoolsAcc.add_widget(self.commonPools)
        self.historyAcc.add_widget(self.history)
        
        # Add Accordion Items
        self.add_widget(self.historyAcc)
        self.add_widget(self.commonPoolsAcc)
    def on_keywords(self, instance, value):
        self.clear_widgets()

        accitem = None
        accgroup = None
        
        for item in value:
            if item['group'].find('filtre') == -1: # We don't use groups with "filtre" in the name, -> only for imagebuttons
                # create new accordion
                k = {}
                if self.title_template:
                    k['title_template'] = self.title_template
                if self.color_file :
                    k['background_normal'] = self.color_file
                if self.color_file_selected :
                    k['background_selected'] = self.color_file_selected
                accitem = AccordionItem(title=item['group'],**k)
                self.add_widget(accitem)
                # create new group
                accgroup = KeywordsGroup(title=item['group'], accitem=accitem)
                accitem.add_widget(accgroup)
                children = item['children']
                if self.alphabetical_sort:
                    children.sort(key=lambda x: x['name'])
                for child in children:
                    keyword = Keyword(text=child['name'], text_id=child['id'],
                            controler=self, group=accgroup)
                    accgroup.add_widget(keyword)
Beispiel #11
0
 def create_layout(self, player):
     item = AccordionItem(title=player)
     layout3 = GridLayout(cols=3)
     for field in fields:
         layy = self.create_count_buttons(field)
         layout3.add_widget(layy)
     item.add_widget(layout3)
     return item
Beispiel #12
0
 def set_sections(self):
     for each in sections:
         item = AccordionItem()
         item.pos = (0, 0)
         item.title = sections[each]
         detail = DetailedData(each)
         item.add_widget(detail)
         self.ids.container.add_widget(item)
Beispiel #13
0
 def build(self):
     root_acc = Accordion(orientation='vertical')
     for player in players_list:
         item = AccordionItem(title=player)
         btn = Button(text=player, background_color=grey)
         item.add_widget(btn)
         item = self.create_layout(player)
         root_acc.add_widget(item)
     return root_acc
 def build(self):
     root = Accordion(orientation='vertical')
     for x in xrange(5):
         item= AccordionItem(title='Image %d' %x)
         src = "images/%d.jpg" % x
         image = Image(source=src,pos=(400, 100), size=(400, 400))
         item.add_widget(image)
         root.add_widget(item)
     return root
Beispiel #15
0
 def show_accordion(self):
     root = Accordion()
     for x in xrange(5):
         item = AccordionItem(title='Title %d' % x)
         item.add_widget(Label(text='Very big content\n' * 10))
         root.add_widget(item)
     col = AnchorLayout()
     col.add_widget(root)
     return col
Beispiel #16
0
 def show_accordion(self):
     root = Accordion()
     for x in xrange(5):
         item = AccordionItem(title='Title %d' % x)
         item.add_widget(Label(text='Very big content\n' * 10))
         root.add_widget(item)
     col = AnchorLayout()
     col.add_widget(root)
     return col
Beispiel #17
0
    def getContent(self):

        content_dict = loadContent()       # in module client
        title_no = 0
        for title, content in content_dict.items():
            # print(title, content)
            title_no += 1
            item = AccordionItem(title=f'{title_no}')
            item.add_widget(EachNoticeWidget(content=title + '\n' + content))
            self.add_widget(item)
Beispiel #18
0
    def build(self):
        for device in Device.objects.order_by('pin'):
            GPIO.setup(device.pin, GPIO.OUT)

        screen = Accordion()
        for category in Category.objects.order_by('order'):
            item = AccordionItem(title=category.label)
            screen.add_widget(item)
            item.add_widget(self.buildCategory(category))
        return screen
    def build(self):
        root = Accordion()
        for x in range(5):
            item = AccordionItem(
                title='Title %d' % x,
                min_space=50)  #involve the value of x instead of d
            item.add_widget(Label(text='Hello World\n' * 5))
            root.add_widget(item)

        return root
Beispiel #20
0
    def order_by_category(self):
        self.ids.container.clear_widgets()
        self.ids.search_holder.clear_widgets()
        self.ids.search_holder.size_hint = (1, 0)

        if self.searchFlag:
            self.searchFlag = False

        for cate in self.category:
            if cate == 'omission':
                accordItem = AccordionItem(
                    background_normal='images/accordion_normal.png',
                    background_selected='images/accordion_selected.png',
                    background_disabled_normal='images/accordion_normal.png',
                    background_disabled_selected='images/accordion_selected.png'
                )
            else:
                accordItem = AccordionItem(
                    background_normal='images/accordion_normal.png',
                    background_selected='images/accordion_selected.png',
                    background_disabled_normal='images/accordion_normal.png',
                    background_disabled_selected='images/accordion_selected.png'
                )
            scroll = ScrollView()
            grid = GridLayout(id='grid',
                              size_hint_y=None,
                              cols=1,
                              row_default_height='80dp',
                              row_force_default=True,
                              spacing=20,
                              padding=20)
            grid.bind(minimum_height=grid.setter('height'))
            scroll.add_widget(grid)
            accordItem.add_widget(scroll)
            accordItem.title = cate
            accordItem.font_name = 'Ubuntu'
            self.ids.container.add_widget(accordItem)

            id_list = self.category[cate]

            for id in id_list:
                mistake_noun = get_mistake_noun(id)
                mistake_verb = get_mistake_verb(id)
                mistake_time = get_mistake_date(id).strftime("%H:%M:%S")
                mistake_cost = str(get_mistake_cost(id))

                new = Entry(name=mistake_noun,
                            verb=mistake_verb,
                            time=mistake_time,
                            cost=mistake_cost)
                grid.add_widget(new)

        self.ids.by_day.background_color = get_color_from_hex('#5D535E')
        self.ids.by_cat.background_color = get_color_from_hex('#669999')
        self.ids.by_search.background_color = get_color_from_hex('#5D535E')
Beispiel #21
0
    def searchList(self, mistakes_id):
        self.ids.container.clear_widgets()
        if len(mistakes_id) == 0:
            accordItem = AccordionItem(
                background_normal='images/accordion_normal.png',
                background_selected='images/accordion_selected.png',
                background_disabled_normal='images/accordion_normal.png',
                background_disabled_selected='images/accordion_selected.png')
            accordItem.title = "No archive found!"
            self.ids.container.add_widget(accordItem)

        dates = {}

        for id in mistakes_id:
            mistake_date = get_mistake_date(id).strftime("%Y-%m-%d")

            if mistake_date not in dates:
                dates[mistake_date] = [id]
            else:
                dates[mistake_date].append(id)

        for date in dates:
            accordItem = AccordionItem(
                background_normal='images/accordion_normal.png',
                background_selected='images/accordion_selected.png',
                background_disabled_normal='images/accordion_normal.png',
                background_disabled_selected='images/accordion_selected.png')
            scroll = ScrollView()
            grid = GridLayout(id='grid',
                              size_hint_y=None,
                              cols=1,
                              row_default_height='80dp',
                              row_force_default=True,
                              spacing=20,
                              padding=20)
            grid.bind(minimum_height=grid.setter('height'))
            scroll.add_widget(grid)
            accordItem.add_widget(scroll)
            accordItem.title = date
            self.ids.container.add_widget(accordItem)

            id_list = dates[date]

            # go through all mistakes for the day
            for id in id_list:
                mistake_noun = get_mistake_noun(id)
                mistake_verb = get_mistake_verb(id)
                mistake_time = get_mistake_date(id).strftime("%H:%M:%S")
                mistake_cost = str(get_mistake_cost(id))

                new = Entry(name=mistake_noun,
                            verb=mistake_verb,
                            time=mistake_time,
                            cost=mistake_cost)
                grid.add_widget(new)
Beispiel #22
0
    def build(self):
        scroller = ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
        root = Accordion(orientation='vertical',size_hint_y=None,height=50*27)
        chart = self.create_gantt()
        for title in chart:
            item = AccordionItem(title=title)
            item.add_widget(Image(source=title))
            root.add_widget(item)

        scroller.add_widget(root)

        return scroller
Beispiel #23
0
    def build(self):
        lista = Accordion()

        for x in range(7):
            item = AccordionItem(title='Item{0}'.format(x + 1))
            item.add_widget(
                Label(text='''Além do horizonte deve ter
Algum lugar bonito pra viver em paz
Onde eu possa encontrar a natureza
Alegria e felicidade com certeza'''))
            lista.add_widget(item)

        return lista
Beispiel #24
0
 def build(self):
     Window.size = (1400, 800)
     bltAll = AllLayout()
     bltCenter = BoxLayout()
     aciInf = AccordionItem(title='ISP Selection')
     aciInf.add_widget(InferencePanel(self.url, self))
     aciCal = AccordionItem(title='Calendar')
     aciCal.add_widget(self.pnlCalendar)
     self.accordion.add_widget(aciInf)
     self.accordion.add_widget(aciCal)
     bltCenter.add_widget(self.accordion)
     bltAll.add_widget(bltCenter)
     return bltAll
Beispiel #25
0
 def build(self):
     Window.size = (1400, 800)
     bltAll = AllLayout()
     bltCenter = BoxLayout()
     aciInf = AccordionItem(title='ISP Selection')
     aciInf.add_widget(InferencePanel(self.url, self))
     aciCal = AccordionItem(title='Calendar')
     aciCal.add_widget(self.pnlCalendar)
     self.accordion.add_widget(aciInf)
     self.accordion.add_widget(aciCal)
     bltCenter.add_widget(self.accordion)
     bltAll.add_widget(bltCenter)
     return bltAll
Beispiel #26
0
    def build(self):
        num_page = 2
        root = Accordion()
        pages = list()

        for page in range(num_page):
            item = AccordionItem(title=f'Title{page}')
            grid = GridLayout(cols=3, spacing=20, padding=10)
            # with grid.canvas:
            #     Color(0.5,0.6,0.7,0.8)
            #     Rectangle(size=grid.size,pos=grid.pos)
            item.add_widget(grid)
            root.add_widget(item)
            pages.append(grid)
        #!!! this must be get from serial port !!!#
        Buttons_text = list(map(lambda num: 'Button ' + str(num), range(1, 6)))
        Buttons_status0 = [
            'open', 'close', 'deactive', 'open', 'close', 'deactive'
        ]
        Buttons_status = dict()
        for name, status in zip(Buttons_text, Buttons_status0):
            Buttons_status[name] = status
        # predefined constants
        Buttons_color = {
            'open': [random(), random(), random(), 0.9],
            'close': [1, 0, 0, 0.9],
            'deactive': [0.5, 0.5, 0.5, 0.9]
        }

        # add Buttons to page 0
        Buttons = list(
            map(
                lambda name: Button(text=name,
                                    background_color=Buttons_color[
                                        Buttons_status[name]]), Buttons_text))
        # Clock.schedule_interval(Buttons[0]., 1.0 / 60.0)
        # Buttons[0].bind(on_press=print('hello world'))
        _ = list(map(lambda button: pages[0].add_widget(button), Buttons))

        # add Gauges to page 1
        Gauges = list(
            map(lambda gauge: Gauge(value=50, size_gauge=200, size_text=19),
                Buttons_text))
        _ = list(map(lambda gauge: pages[1].add_widget(gauge), Gauges))

        ### defines events
        _ = list(
            map(
                lambda button: button.bind(on_press=lambda button: self.
                                           ErrorWindow()), Buttons))
        return root
    def build(self):
        root = Accordion()
        root = Accordion(min_space=60)
        # Providing the orentation
        root = Accordion(orientation='vertical')

        # Adding text to each Accordion
        for x in range(5):
            item = AccordionItem(title='Title % d' % x)
            item.add_widget(
                Label(text='GFG is Good Website foe CSE Students\n' * 5))
            root.add_widget(item)

        # Reurn the root
        return root
Beispiel #28
0
    def add_pages(self):
        self.clear_widgets()
        for c in self.crime_tab:
            self.add_widget(Page(c))  
            
        l = '\n'.join(['Proletariat - The working poor, non-believers of IngSoc.',
                       'Outer Party - Middle class members of The Party',
                       'Inner Party - Individuals having demonstrated dedication to Ingsoc and The Party.'])
        a = AccordionItem(title='Classes')
        class_list = BoxLayout(orientation='vertical')
        class_list.add_widget(Label(text=l))
        a.add_widget(class_list)
        self.add_widget(a)

        lab = Label(text=l)
Beispiel #29
0
 def buildContent(self):
     self.ids.setupAccordion.clear_widgets(children=self.ids.setupAccordion.children)
     setupList = []
     for key in gameSetups.keys():
         if gameSetups.get(key).get('playerNumber') == Mafia.playerNumber:
             setupList.append(str(key))
     for setup in setupList:
         item = AccordionItem(title=setup, background_normal='atlas://img/button/buttonatlas/midnight',
             background_selected='atlas://img/button/buttonatlas/sky')
         itemContent = BoxLayout(orientation='vertical')
         itemContent.add_widget(multiLineLabel(text=gameSetups.get(setup).get('description'),
          halign='center', valign='middle'))
         itemContent.add_widget(Image(source=gameSetups.get(setup).get('src')))
         item.add_widget(itemContent)
         self.ids.setupAccordion.add_widget(item)
Beispiel #30
0
    def __init__(self, *args, **kwargs):
        super(Settings, self).__init__(**kwargs)
        self.orientation = "vertical"
        self.accordion = Accordion(orientation="vertical")
        for x in [General, Themes, About]:
            item = AccordionItem(title=str(x.__name__), title_template="Panel")
            item.box = x(orientation="vertical")
            item.add_widget(item.box)
            self.accordion.add_widget(item)

        for x in self.accordion.children:
            x.collapse = False if type(x.box).__name__ == "General" else True

        self.add_widget(self.accordion)
        self.save_buttons = SaveButtons(size_hint_y=0.1)
        self.add_widget(self.save_buttons)
    def __init__(self, **kwargs):
        super(ConnectionScreen, self).__init__(**kwargs)

        self.root = Accordion()
        roleItem = AccordionItem(title='Role')
        self.root.add_widget(roleItem)
        serverItem = AccordionItem(title='Server')
        self.root.add_widget(serverItem)
        self.dmBtn = ToggleButton(text="DM", group="role")
        self.pcBtn = ToggleButton(text="Player", group="role", state="down")
        self.textinput = TextInput(text='John-LAPTOP', multiline=False)
        self.textinput.bind(on_text_validate=self.on_confirm)
        roleItem.add_widget(self.dmBtn)
        roleItem.add_widget(self.pcBtn)
        serverItem.add_widget(self.textinput)
        self.add_widget(self.root)
Beispiel #32
0
 def _build_schema(self, schema):
     '''
     Build UI widgets and the structure of the dictionary sent back to the tunable
     '''
     self.param_schema = dict()
     for key in schema:
         self.param_schema[key] = dict()
         item = AccordionItem(title=key)
         layout = GridLayout(cols=1, spacing=20, padding=10)
         item.add_widget(layout)
         for param in schema[key]:
             widget = AccordionSlider(self,
                                      **schema[key][param],
                                      param_label=param)
             self.param_schema[key][param] = widget
             layout.add_widget(widget)
         self.content_area.add_widget(item)
Beispiel #33
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        btn2 = Button(
            text='New Game',
            size_hint=(.5, .25),
            pos_hint={'left': 0, 'top': 1}
        )
        """btn2.bind(on_press=self.change_screen_to_game())
        self.add_widget(btn2)"""



        for x in range(5):
            item = AccordionItem()
            item.add_widget(Label(text='Very big content\n' * 10))
            self.add_widget(item)
Beispiel #34
0
class MainMenuScreen(BaseScreen):
    def __init__(self, name, *navigate_screens):
        super(MainMenuScreen, self).__init__(name, *navigate_screens)

        self.accordion = MDAccordion(orientation='vertical')

        self.profile = AccordionItem(title='Profile')
        self.feed = AccordionItem(title='Feed')

        self.accordion.add_widget(self.profile)
        self.accordion.add_widget(self.feed)

        self.lower_panel.add_widget(self.accordion)

        base_box = BoxLayout(orientation='vertical')

        box = BoxLayout(orientation='vertical', spacing=5)
        box.add_widget(
            AsyncImage(
                source=
                'https://codeguida.com/media/post_title/kivy-logo-black-256_70JCttF.png',
                size_hint_y=.2,
                size_hint_x=.5))
        menu_items_box = BoxLayout(orientation='vertical',
                                   padding=2,
                                   size_hint_y=.5)

        base_box.add_widget(box)
        base_box.add_widget(menu_items_box)

        self.username_label = MenuItemLabel(text='Test username')
        self.followers_label = MenuItemLabel(text='Followers')
        self.posts_amount = MenuItemLabel(text='Posts published')

        menu_items_box.add_widget(self.username_label)
        menu_items_box.add_widget(self.followers_label)
        menu_items_box.add_widget(self.posts_amount)

        self.profile.add_widget(base_box)

        # self.feed.add_widget(FeedItem(image_path='https://codeguida.com/media/post_title/kivy-logo-black-256_70JCttF.png'))
        self.feed.add_widget(Feed())

    def update_label(self, *args):
        pass
Beispiel #35
0
    def searchList(self, mistakes_id):
        self.ids.container.clear_widgets()
        if len(mistakes_id) == 0:
            accordItem = AccordionItem(background_normal='images/accordion_normal.png',
                                        background_selected='images/accordion_selected.png',
                                        background_disabled_normal='images/accordion_normal.png',
                                        background_disabled_selected='images/accordion_selected.png')
            accordItem.title = "No archive found!"
            self.ids.container.add_widget(accordItem)

        dates = {}

        for id in mistakes_id:
                mistake_date = get_mistake_date(id).strftime("%Y-%m-%d")

                if mistake_date not in dates:
                    dates[mistake_date] = [id]
                else:
                    dates[mistake_date].append(id)

        for date in dates:
            accordItem = AccordionItem(background_normal='images/accordion_normal.png',
                                        background_selected='images/accordion_selected.png',
                                        background_disabled_normal='images/accordion_normal.png',
                                        background_disabled_selected='images/accordion_selected.png')
            scroll = ScrollView()
            grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20)
            grid.bind(minimum_height=grid.setter('height'))
            scroll.add_widget(grid)
            accordItem.add_widget(scroll)
            accordItem.title = date
            self.ids.container.add_widget(accordItem)

            id_list = dates[date]

            # go through all mistakes for the day
            for id in id_list:
                mistake_noun = get_mistake_noun(id)
                mistake_verb = get_mistake_verb(id)
                mistake_time = get_mistake_date(id).strftime("%H:%M:%S")
                mistake_cost = str(get_mistake_cost(id))

                new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost=mistake_cost)
                grid.add_widget(new)
Beispiel #36
0
    def order_by_category(self):
        self.ids.container.clear_widgets()
        self.ids.search_holder.clear_widgets()
        self.ids.search_holder.size_hint=(1, 0)

        if self.searchFlag:
            self.searchFlag = False

        for cate in self.category:
            if cate == 'omission':
                accordItem = AccordionItem(background_normal='images/accordion_normal.png',
                                            background_selected='images/accordion_selected.png',
                                            background_disabled_normal='images/accordion_normal.png',
                                            background_disabled_selected='images/accordion_selected.png')
            else:
                accordItem = AccordionItem(background_normal='images/accordion_normal.png',
                                            background_selected='images/accordion_selected.png',
                                            background_disabled_normal='images/accordion_normal.png',
                                            background_disabled_selected='images/accordion_selected.png')
            scroll = ScrollView()
            grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20)
            grid.bind(minimum_height=grid.setter('height'))
            scroll.add_widget(grid)
            accordItem.add_widget(scroll)
            accordItem.title = cate
            accordItem.font_name = 'Ubuntu'
            self.ids.container.add_widget(accordItem)

            id_list = self.category[cate]

            for id in id_list:
                mistake_noun = get_mistake_noun(id)
                mistake_verb = get_mistake_verb(id)
                mistake_time = get_mistake_date(id).strftime("%H:%M:%S")
                mistake_cost = str(get_mistake_cost(id))

                new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost= mistake_cost)
                grid.add_widget(new)

        self.ids.by_day.background_color = get_color_from_hex('#5D535E')
        self.ids.by_cat.background_color = get_color_from_hex('#669999')
        self.ids.by_search.background_color = get_color_from_hex('#5D535E')
Beispiel #37
0
    def __init__(self, **kwargs):
        super(InterfaceManager, self).__init__(**kwargs)

        self.first = Login()

        self.second = Accordion()
        self.second = Accordion(orientation='vertical')
        options = ['My profile', 'New Object', 'Find Objects']

        for key in options:
            item = AccordionItem(title='%s' % key)
            if key == 'New Object':
                item.add_widget(NewObject())
            if key == 'Find Objects':
                item.add_widget(FindObjects())

            self.second.add_widget(item)

        self.final = Label(text="Hello World")
        self.add_widget(self.first)
Beispiel #38
0
    def build(self):
        root = Accordion(orientation='vertical')
        item = AccordionItem(title='Gate Transactions')
        item.add_widget(Label(text=\
        """1) Login to Port of Virginia
2) Fill in these fields
3) Click "Get URL" and paste the URL into the browser
4) Copy all text (Command or Control+A) on this page
5) Click this button to create the CSV"""))
        page = BoxLayout(orientation='vertical')
        subpage = BoxLayout(orientation='vertical')
        input1 = BoxLayout(orientation='horizontal')
        input2 = BoxLayout(orientation='horizontal')
        input3 = BoxLayout(orientation='horizontal')
        input1.add_widget(Label(text='Start Date (yyyy-mm-dd):'))
        self.start_date = TextInput(text=datetime.now().strftime("%Y-%m-01"))
        input1.add_widget(self.start_date)
        input2.add_widget(Label(text='End Date (yyyy-mm-dd):'))
        self.end_date = TextInput(text=datetime.now().strftime("%Y-%m-%d"))
        input2.add_widget(self.end_date)
        input3.add_widget(Label(text='License Plate:'))
        self.license_plate = TextInput(text="UN11316,UN11316,UN11316")
        input3.add_widget(self.license_plate)
        buttons = GridLayout(cols=1)
        button = Button(text="Get URL", font_size=24)
        button.bind(on_press=self.get_url)
        buttons.add_widget(button)
        button = Button(text="JSON to CSV", font_size=24)
        button.bind(on_press=self.json_to_csv)
        buttons.add_widget(button)
        button = Button(text="List of Licenses to CSV", font_size=24)
        button.bind(on_press=self.get_urls_and_json_to_csv)
        buttons.add_widget(button)
        page.add_widget(subpage)
        subpage.add_widget(input1)
        subpage.add_widget(input2)
        subpage.add_widget(input3)
        page.add_widget(buttons)
        item.add_widget(page)
        root.add_widget(item)
        return root
Beispiel #39
0
 def __init__(self, username, userid, level, levelname, name):
     self.name = name
     self.username = username
     self.userid = userid
     self.level = level
     self.levelname = levelname
     super(LevelListScreen, self).__init__()
     
     # Get level sections from database.
     conn = sqlite3.connect(filehome + 'database.db')
     c = conn.cursor()
     levelsections = c.execute('''SELECT levelsectionid, levelsectionname, levelsectionimage FROM levelsection WHERE levelid = ?''', (level,))
     box = BoxLayout(orientation = 'vertical')
     box.add_widget(Banner(self.levelname, 1, self.userid))
     topAccordion = Accordion(orientation = 'vertical', min_space = dp(25), anim_duration = 1)
     
     # Adding an accordion item for each of the levelsections
     for i in levelsections:
         item = AccordionItem(title = i[1], min_space = dp(25), background_normal='images/blue32025.png', background_selected = 'images/orange32025.png')
         boxa = BoxLayout(orientation = 'vertical')
         boxa.add_widget(AsyncImage(source = i[2]))
         
         # Get topics for the current level section from the database.
         c1 = conn.cursor()
         levelsectiontopics = c1.execute('''SELECT topicid, topicname, topicpage FROM topics WHERE levelsectionid = ?''', (i[0],))
         
         # Add a button for each topic within the section
         for j in levelsectiontopics:
             boxa.add_widget(Button(text=j[1], id= j[1] + ',' + j[2], on_press = self.selecttopic, background_normal = 'images/orange32030.png', background_down = 'images/blue32025.png', size_hint_y = None, height = dp(30)))
         item.add_widget(boxa)
         topAccordion.add_widget(item)
     
     quizitem = AccordionItem(title = 'Quiz', min_space = dp(25), background_normal = 'images/blue32025.png', background_selected = 'images/orange32025.png')
     boxb = BoxLayout(orientation = 'vertical')
     boxb.add_widget(Label(text = 'Want to test your knowledge for this level?'))
     boxb.add_widget(Button(text = 'Quiz here', on_press = self.quiz, id = level, background_normal = 'images/orange32030.png', background_down = 'images/blue32025.png', size_hint_y = None, height = dp(30)))
     quizitem.add_widget(boxb)
     topAccordion.add_widget(quizitem)
     box.add_widget(topAccordion)
     self.add_widget(box)
     conn.close()
	def build(self):
		self.title = "HP4156C Parameter Analyser"
		## Main screen has a title and two accordions
		root = BoxLayout(orientation='vertical')
		## Add a title header to the window
		header = Label(text="HP4156C Parameter Analyser", font_size=20, size_hint_y=None, height=25)
		root.add_widget(header)
		## The main Accordion menu
		menu = Accordion()
		## The first accordion tab has three buttons
		item = AccordionItem(title='Configuration')
		item.add_widget(Label(text='Very big content\n' * 10))
		menu.add_widget(item)
		## The second accordion tab graphs data and saves to excel
		item = AccordionItem(title='Results')
		item.add_widget(Label(text='Very big content\n' * 10))
		menu.add_widget(item)
		## Add the accordion to the main screen
		root.add_widget(menu)
		
		return root
Beispiel #41
0
    def fill_accordion_item(self, store):
        storage_butt = AccordionItem()
        storage_butt.id = str(store.id)
        storage_butt.height = 22
        storage_butt.title = str(store.name)

        scroll = ScrollView()
        scroll.do_scroll_x = False
        scroll.size_hint = (1, 1)
        scroll.bar_color = [.5, .10, .15, .8]
        scroll.bar_inactive_color = [.5, .20, .10, .5]
        scroll.scroll_type = ['bars']  # [‘bars’, ‘content’]

        tree_obj = TreeView()
        tree_obj.size_hint = (1, None)
        tree_obj.hide_root = True

        store.tree_view = WeakProxy(tree_obj)
        scroll.add_widget(tree_obj)
        storage_butt.add_widget(scroll)
        return storage_butt
    def __init__(self, **kwargs):
        super(SelectionScreen, self).__init__(**kwargs)

        global Combatants
        self.root = Accordion()
        charItem = AccordionItem(title='Characters')
        self.root.add_widget(charItem)
        enItem = AccordionItem(title='Enemies')
        self.root.add_widget(enItem)
        confirmItem = AccordionItem(title='Done')
        self.root.add_widget(confirmItem)
        self.CharButtons = []
        self.EnemyButtons = []
        self.enemyIter = 0
        self.quantity = 0
        self.content = TextInput(text='1', multiline=False)
        self.content.bind(on_text_validate=self.setQuantity)
        i = 0
        while i < Combatants.getNumChars():
            btn = ToggleButton(text=Combatants.getCharName(i))
            charItem.add_widget(btn)
            self.CharButtons.append(btn)
            i = i+ 1
        i = 0
        while i < Combatants.getNumEn():
            btn = ToggleButton(text=Combatants.getEnName(i))
            enItem.add_widget(btn)
            self.EnemyButtons.append(btn)
            i = i + 1
        B = Button(text='Go!')
        B.bind(on_press=self.showCombatants)
        confirmItem.add_widget(B)
        self.add_widget(self.root)
Beispiel #43
0
    def build(self):
        lista = Accordion()

        item = AccordionItem(
            title='Amor',
            background_normal='cores.jpg',
            background_selected=
            'um-video-super-legal-com-imagens-do-por-do-sol-muito-lindo.jpg')

        item.add_widget(
            Label(text='''
Bom o que sinto as vezes, tenho medo de sentir, 
sera que eu sou a pessoa certa?, tenho  muitas insertezas, dizem que 
quando a gente gosta não que saber e que a pessoa pra si, mas eu 
agora não sei se só estou gostando será, eu mudei quero ter uma familia a pessoa 
que eu estou gostando ela tem seu receios. Não sei se isso é o certo, acredito que 
esse sentimento seja amor apaixonado tenho que esperar. Um dia tive uma crise de 
paixão logo outro dia me recuperei meio que não sentia mais que gosta, acredito 
que deva esperar.
		'''))

        item1 = AccordionItem(title='B')

        item2 = AccordionItem(title='C')

        item1.add_widget(Label(text='Pão'))
        item2.add_widget(Label(text='Oleo'))

        lista.add_widget(item2)
        lista.add_widget(item)
        lista.add_widget(item1)
        return lista
    def build(self):
        self.title = "HP4156C Parameter Analyser"
        ## Main screen has a title and two accordions
        root = BoxLayout(orientation='vertical')
        ## Add a title header to the window
        header = Label(text="HP4156C Parameter Analyser",
                       font_size=20,
                       size_hint_y=None,
                       height=25)
        root.add_widget(header)
        ## The main Accordion menu
        menu = Accordion()

        ## The first accordion tab has three buttons
        item = AccordionItem(title='Configuration')
        item.add_widget(Configuration())
        menu.add_widget(item)
        #the above section can be repeated to add more accordion items

        ## Add the accordion to the main screen
        root.add_widget(menu)
        return root
Beispiel #45
0
 def nextland(self):
     global AllLands
     if (len(AllLands) == self.cur + 1):
         popup = Popup(title='Error!',
                       content=Label(text='No More Lands!!'),
                       size_hint=(None, None),
                       size=(200, 200))
         popup.open()
         return
     else:
         self.ids.acc.clear_widgets()
         if (len(AllLands) - 1 - self.cur >= 4):
             for i in range(self.cur + 1, self.cur + 5):
                 txt = str("")
                 txt += "[b][color=87ceeb]"
                 txt += str(
                     str(AllLands[i][0]) + "\n " + AllLands[i][1] + "\n" +
                     AllLands[i][2] + "\n" + AllLands[i][3])
                 txt += '[/color][/b]'
                 item = AccordionItem(title='Land %d' % (i + 1),
                                      orientation='vertical')
                 item.add_widget(Button(text=txt, markup=True))
                 self.ids.acc.add_widget(item)
             self.cur += 4
         else:
             for i in range(self.cur + 1, len(AllLands)):
                 print("Yes")
                 txt = str("")
                 txt += "[b][color=87ceeb]"
                 txt += str(
                     str(AllLands[i][0]) + "\n " + AllLands[i][1] + "\n" +
                     AllLands[i][2] + "\n" + AllLands[i][3])
                 txt += '[/color][/b]'
                 item = AccordionItem(title='Land %d' % (i + 1),
                                      orientation='vertical')
                 print(txt)
                 item.add_widget(Button(text=txt, markup=True))
                 self.ids.acc.add_widget(item)
             self.cur = len(AllLands) - 1
Beispiel #46
0
    def on_keywords(self, instance, value):
        self.clear_widgets()

        accitem = None
        accgroup = None
        for item in value:
            # create new accordion
            k = {}
            if self.title_template:
                k['title_template'] = self.title_template
            accitem = AccordionItem(title=item['group'], **k)
            self.add_widget(accitem)
            # create new group
            accgroup = KeywordsGroup(title=item['group'], accitem=accitem)
            accitem.add_widget(accgroup)
            children = item['children']
            if self.alphabetical_sort:
                children.sort(key=lambda x: x['name'])
            for child in children:
                keyword = Keyword(text=child['name'], text_id=child['id'],
                        controler=self, group=accgroup)
                accgroup.add_widget(keyword)
Beispiel #47
0
 def prevland(self):
     global AllLands
     if (self.cur <= 3):
         popup = Popup(title='Error!',
                       content=Label(text='No More Lands!!'),
                       size_hint=(None, None),
                       size=(200, 200))
         popup.open()
         return
     elif (self.cur >= 3):
         self.cur -= 4
         self.ids.acc.clear_widgets()
         for i in range(self.cur, self.cur + 4):
             txt = str("")
             txt += "[b][color=87ceeb]"
             txt += str(
                 str(AllLands[i][0]) + "\n " + AllLands[i][1] + "\n" +
                 AllLands[i][2] + "\n" + AllLands[i][3])
             txt += '[/color][/b]'
             item = AccordionItem(title='Land %d' % (i + 1),
                                  orientation='vertical')
             item.add_widget(Button(text=txt, markup=True))
             self.ids.acc.add_widget(item)
     else:
         self.cur = 0
         self.ids.acc.clear_widgets()
         for i in range(self.cur, self.cur + 4):
             txt = str("")
             txt += "[b][color=87ceeb]"
             txt += str(
                 str(AllLands[i][0]) + "\n " + AllLands[i][1] + "\n" +
                 AllLands[i][2] + "\n" + AllLands[i][3])
             txt += '[/color][/b]'
             item = AccordionItem(title='Land %d' % (i + 1),
                                  orientation='vertical')
             item.add_widget(Button(text=txt, markup=True))
             self.ids.acc.add_widget(item)
         self.cur = 3
Beispiel #48
0
class ATDR(Accordion):
    def __init__(self, **kwargs):
        super(ATDR, self).__init__(**kwargs)
        self.orientation = "horizontal"
        
        # Accordion Items
        self.diceAcc = AccordionItem(
            title = "Dice Pools"
            )
        self.crit_forceAcc = AccordionItem(
            title = "Critical Injuries and Force Dice"
            )
        
        # Things inside of the Accordion Items
        self.dice = dice_UI()
        self.crit_force = InjuryAndForceUI()
        
        # Add interior items to Accordion Items
        self.diceAcc.add_widget(self.dice)
        self.crit_forceAcc.add_widget(self.crit_force)
        
        # Add Accordion Items
        self.add_widget(self.crit_forceAcc)
        self.add_widget(self.diceAcc)
Beispiel #49
0
    def build(self):
        root = Accordion(orientation="vertical")
        for x in range(4):
            item = AccordionItem(title='Screen %d' % x)
            item.add_widget(Button(text='Vis TimeLapse\n', size_hint=(0.25,0.25), 
                                   pos=(100, 100)))
            item.add_widget(Button(text='IR TimeLapse\n', size_hint=(0.25,0.25),
                                   pos=(100, 100)))
            item.add_widget(Button(text='Vis Live\n', size_hint=(0.25,0.25),
                                   pos=(100, 100)))
            item.add_widget(Button(text='IR Live\n', size_hint=(0.25,0.25),
                                   pos=(100, 100)))



            root.add_widget(item)
        return root
class ActionMenu(Screen):
    def __init__(self, **kwargs):
        super(ActionMenu, self).__init__(**kwargs)

        self.root = Accordion(orientation='vertical')
        self.targItem = AccordionItem(title='Target')
        self.root.add_widget(self.targItem)
        self.conItem = AccordionItem(title='Confirm')
        self.root.add_widget(self.conItem)
        B = Button(text='Confirm')
        B2 = Button(text='Cancel')
        B.bind(on_press=self.confirmTarget)
        B2.bind(on_press=self.cancel)
        self.conItem.add_widget(B)
        self.conItem.add_widget(B2)
        self.add_widget(self.root)

    def populate(self):
        self.ComButtons = []
        for c in Combatants.retList():
            btn = ToggleButton(text=c.name, group='targets')
            self.targItem.add_widget(btn)
            self.ComButtons.append(btn)

    def confirmTarget(self, obj):
        hasTarget = False
        i = 0
        for b in self.ComButtons:
            if b.state == 'down':
                hasTarget = True
                Screens[2].Target = Combatants.get(i)
            i += 1
        if hasTarget == True:
            hasTarget = False
            self.targItem.clear_widgets(children=self.ComButtons)
            self.ComButtons.clear()
            Combatants.get(0).hasActed = True
            Screens[2].AttackButton.disabled = True
            self.manager.current = 'Battle Screen'
            Screens[2].Attack()

    def cancel(self, obj):
        self.targItem.clear_widgets(children=self.ComButtons)
        self.ComButtons.clear()
        self.manager.current = 'Battle Screen'
Beispiel #51
0
class PageSendMail(BoxLayout):
    title = StringProperty("Screen page created message:")
    """Подпись макета окна."""
    message_to = StringProperty("[size=18][color=#ffffffff]Message for "
                                "[color=#2fbfe0]Name Profile:[/size]")
    """Подпись, кому адресовано письмо."""
    accordion_panel_text_title = StringProperty("Text")
    """Подпись панели текста."""
    accordion_panel_smiles_title = StringProperty("Smiles")
    """Подпись панели смайлов."""
    hint_text = StringProperty("Enter text message...")
    """Текст подсказки в поле ввода сообщения."""
    default_text = StringProperty("")
    """Текст по умолчанию."""
    background_image = StringProperty(
        "atlas://data/images/defaulttheme/modalview-background")
    """Фоновое изображение окна."""

    # Подписи чеков приоритета сообщения. Низкий/Обычный/Высокий.
    label_priority = StringProperty("Priority")
    priority_low = StringProperty("Low")
    priority_normal = StringProperty("Normal")
    priority_tall = StringProperty("Tall")

    # Подписи чеков приоритета сообщения.
    # Отчет о прочтении/Сохранить в отправленных/Добавить файл.
    label_report = StringProperty("Report")
    read_report = StringProperty("Read report")
    save_in_sent = StringProperty("Save in sent")
    add_files = StringProperty("Add files")

    text_button_ok = StringProperty("Yes")
    text_button_cancel = StringProperty("Cancel")

    # Изображение активного и не активного пункта аккордиона.
    background_selected = StringProperty(
        "atlas://data/images/defaulttheme/button_pressed")
    background_normal = StringProperty(
        "atlas://data/images/defaulttheme/button")

    # Кастомные изображения для checkbox.
    background_checkbox_normal = StringProperty(
        'atlas://data/images/defaulttheme/checkbox_off')
    background_checkbox_down = StringProperty(
        'atlas://data/images/defaulttheme/checkbox_on')
    background_radio_normal = StringProperty(
        'atlas://data/images/defaulttheme/checkbox_radio_off')
    background_radio_down = StringProperty(
        'atlas://data/images/defaulttheme/checkbox_radio_on')

    path_to_folder_images_smiles = StringProperty("")
    """Путь к папке с набором смайлов."""
    list_images_for_format_text = ListProperty([])
    """Список путей к изображениям, используемых в панели для форматирования
    текста."""
    events_callback = ObjectProperty(p)

    forum = StringProperty("mail")
    """Если 'forum' - пишется ответ в форум - форма избавляется от чеков
    приоритета сообщения."""

    def __init__(self, **kvargs):
        super(PageSendMail, self).__init__(**kvargs)
        self.orientation = "vertical"

        self.add_widget(Label(text=self.message_to, markup=True,
                              size_hint=(1, .1)))
        accordion = Accordion(orientation="vertical")

        # Панель смайлов.
        self.smiles = \
            AccordionItem(title=self.accordion_panel_smiles_title,
                          background_selected=self.background_selected,
                          background_normal=self.background_normal)
        smiles_box = StackLayout()

        if os.path.exists(self.path_to_folder_images_smiles):
            for name_image in os.listdir(self.path_to_folder_images_smiles):
                smile = \
                    ImageButton(
                        source="{}/{}".format(
                            self.path_to_folder_images_smiles, name_image),
                        id=":{}:".format(name_image.split(".")[0]),
                        size_hint=(.09, .12))
                smile.bind(on_press=self.events_callback)
                smiles_box.add_widget(smile)

        self.smiles.add_widget(smiles_box)
        accordion.add_widget(self.smiles)

        # Панель форматирования и поле ввода.
        text = AccordionItem(title=self.accordion_panel_text_title,
                             background_selected=self.background_selected,
                             background_normal=self.background_normal)
        content = BoxLayout(orientation="vertical")

        # TODO: Слишком маленькие иконки на панели форматирования текста.
        # Сделать иконки в два ряда.
        if platform == "android":
            size_hint = (1, .12)
        else:
            size_hint = (1, .06)

        formats_panel = BoxLayout(size_hint=size_hint)

        # Иконки форматирования.
        for name_image in self.list_images_for_format_text:
            format_button = \
                ImageButton(id=os.path.split(name_image)[1].split(".")[0],
                            source=name_image)
            format_button.bind(on_press=self.events_callback)
            formats_panel.add_widget(format_button)

        self.text_input = TextInput(hint_text=self.hint_text,
                                    size_hint=(1, .4), auto_indent=True)
        if self.default_text != "":
            self.text_input.text = self.default_text

        content.add_widget(formats_panel)
        content.add_widget(self.text_input)
        text.add_widget(content)
        accordion.add_widget(text)

        # Подписи и чекбоксы.
        message_to = GridLayout(cols=2, size_hint=(1, .22), spacing=5)

        if self.forum == "mail":
            message_to.add_widget(Label(text=self.label_priority,
                                        markup=True))
            message_to.add_widget(Widget())

            message_to.add_widget(Label(text=self.priority_low))
            self.low_check = \
                CheckBox(background_radio_down=self.background_radio_down,
                         background_radio_normal=self.background_radio_normal,
                         id="low", group="priority")
            self.low_check.bind(active=self.events_callback)
            message_to.add_widget(self.low_check)

            message_to.add_widget(Label(text=self.priority_normal))
            self.normal_check = \
                CheckBox(background_radio_down=self.background_radio_down,
                         background_radio_normal=self.background_radio_normal,
                         active=True, id="normal", group="priority")
            self.normal_check.bind(active=self.events_callback)
            message_to.add_widget(self.normal_check)

            message_to.add_widget(Label(text=self.priority_tall))
            self.tall_check = \
                CheckBox(background_radio_down=self.background_radio_down,
                         background_radio_normal=self.background_radio_normal,
                         id="tall", group="priority")
            self.tall_check.bind(active=self.events_callback)
            message_to.add_widget(self.tall_check)

        additional = GridLayout(cols=2, size_hint=(1, .22), spacing=5)

        if self.forum == "mail":
            additional.add_widget(Label(text=self.label_report,
                                        markup=True))
            additional.add_widget(Widget())

            additional.add_widget(Label(text=self.save_in_sent))
            self.save_in_sent_check = \
                CheckBox(
                    background_checkbox_down=self.background_checkbox_down,
                    background_checkbox_normal=self.background_checkbox_normal,
                    active=True, id="save in sent")
            self.save_in_sent_check.bind(active=self.events_callback)
            additional.add_widget(self.save_in_sent_check)

            additional.add_widget(Label(text=self.read_report))
            self.read_report_check = \
                CheckBox(
                    background_checkbox_down=self.background_checkbox_down,
                    background_checkbox_normal=self.background_checkbox_normal,
                    id="read report")
            self.read_report_check.bind(active=self.events_callback)
            additional.add_widget(self.read_report_check)

        self.add_files_label = Label(text=self.add_files)
        additional.add_widget(self.add_files_label)
        self.add_files_check = \
            CheckBox(
                background_checkbox_down=self.background_checkbox_down,
                background_checkbox_normal=self.background_checkbox_normal,
                id="add files",)
        self.add_files_check.bind(active=self.events_callback)
        additional.add_widget(self.add_files_check)

        # Кнопки выбора.
        button_panel = BoxLayout(size_hint=(1, .15))
        for name_button in [self.text_button_ok, self.text_button_cancel]:
            select_button = Button(text=name_button, size_hint=(1, 1),
                                   id=name_button)
            select_button.bind(on_press=self.events_callback)
            button_panel.add_widget(select_button)

        self.add_widget(accordion)

        self.add_widget(Widget(size_hint=(None, .02)))
        if self.forum == "mail":
            self.add_widget(message_to)
        self.add_widget(Widget(size_hint=(None, .02)))
        self.add_widget(SettingSpacer())

        self.add_widget(additional)
        self.add_widget(Widget(size_hint=(None, .02)))
        self.add_widget(SettingSpacer())
        self.add_widget(Widget(size_hint=(None, .02)))

        self.add_widget(button_panel)

        self.body = Popup(title=self.title, content=self, size_hint=(.9, .99),
                          background=self.background_image)
        self.body.open()

    def get_status_checks(self):
        return {self.low_check.id: self.low_check.active,
                self.normal_check.id: self.normal_check.active,
                self.tall_check.id: self.tall_check.active,
                self.save_in_sent_check.id: self.save_in_sent_check.active,
                self.read_report_check.id: self.read_report_check.active,
                self.add_files_check.id: self.add_files_check.active}
Beispiel #52
0
    def order_by_time(self):
        self.all_entries = []
        self.dates = {}
        self.category = {}

        self.ids.container.clear_widgets()
        self.ids.search_holder.clear_widgets()
        self.ids.search_holder.size_hint=(1, 0)

        self.all_entries = get_all_entries_id()

        if self.all_entries is None:
            self.list_empty_archive()
            return

        # Get all mistakes and get date list
        for ind, eid in enumerate(self.all_entries):
            mistakes_id = get_entry_mistakes_id(eid)
            if mistakes_id is None:
                continue

            # parse all mistakes by date and categories
            for id in mistakes_id:
                mistake_date = get_mistake_date(id).strftime("%Y-%m-%d")

                if mistake_date not in self.dates:
                    self.dates[mistake_date] = [id]
                else:
                    self.dates[mistake_date].append(id)

                self.category['omission'] = get_mistakes_category_id(True)
                self.category['commission'] = get_mistakes_category_id(False)

        if self.searchFlag:
            self.searchFlag = False

        self.sortedDate= []
        for date in self.dates:
            self.sortedDate.append(datetime.datetime.strptime(date, '%Y-%m-%d').date())

        print("date: " + str(sorted(self.sortedDate)))

        # Iterate over date list and order mistakes by date
        for date in sorted(self.sortedDate):
            accordItem = AccordionItem(background_normal='images/accordion_normal.png',
                                        background_selected='images/accordion_selected.png',
                                        background_disabled_normal='images/accordion_normal.png',
                                        background_disabled_selected='images/accordion_selected.png')
            scroll = ScrollView()
            grid = GridLayout(id='grid', size_hint_y=None, cols=1, row_default_height='80dp', row_force_default=True, spacing=20, padding=20)
            grid.bind(minimum_height=grid.setter('height'))
            scroll.add_widget(grid)
            accordItem.add_widget(scroll)
            accordItem.title = date.strftime("%Y-%m-%d")
            self.ids.container.add_widget(accordItem)

            id_list = self.dates[date.strftime("%Y-%m-%d")]

            # go through all mistakes for the day
            for id in id_list:
                mistake_noun = get_mistake_noun(id)
                mistake_verb = get_mistake_verb(id)
                mistake_time = get_mistake_date(id).strftime("%H:%M:%S")
                mistake_cost = str(get_mistake_cost(id))

                new = Entry(name=mistake_noun, verb=mistake_verb, time=mistake_time, cost=mistake_cost)
                grid.add_widget(new)

        self.ids.by_day.background_color = get_color_from_hex('#669999')
        self.ids.by_cat.background_color = get_color_from_hex('#5D535E')
        self.ids.by_search.background_color = get_color_from_hex('#5D535E')
Beispiel #53
0
        '''return a global index corresponding to a datetime. '''
        secs = (dt - unixepoch).total_seconds() 
        global_idx = secs / TimeTick.scale_factor_dict['second']
        return global_idx
    def pos_of_time(self, time):
        return self.index2pos(self.index_of(time))
    def timedelta2dist(self, td):
        return td.days * self.scale
    def center_on_timeframe(self, start, end):
        self.index_0 = self.index_of(start)
        self.index_1 = self.index_of(end)
                
if __name__ == '__main__':
    acc = Accordion(orientation='vertical')
    simple = AccordionItem(title='simple')
    simple.add_widget(Timeline())
    complex_ = AccordionItem(title='complex')
    complex_.add_widget(
        Timeline(backward=True,
                 orientation='horizontal',
                 ticks=selected_time_ticks() + [TimeTick(valign='top',
                                                         mode='12 hours'),
                                                TimeTick(valign='line_bottom',
                                                         mode='2 hours')],
                 line_offset=dp(130)
                 ))
    acc.add_widget(simple)
    acc.add_widget(complex_)
    runTouchApp(acc)

Beispiel #54
0
    def __init__(self, **kvargs):
        super(PageSendMail, self).__init__(**kvargs)
        self.orientation = "vertical"

        self.add_widget(Label(text=self.message_to, markup=True,
                              size_hint=(1, .1)))
        accordion = Accordion(orientation="vertical")

        # Панель смайлов.
        self.smiles = \
            AccordionItem(title=self.accordion_panel_smiles_title,
                          background_selected=self.background_selected,
                          background_normal=self.background_normal)
        smiles_box = StackLayout()

        if os.path.exists(self.path_to_folder_images_smiles):
            for name_image in os.listdir(self.path_to_folder_images_smiles):
                smile = \
                    ImageButton(
                        source="{}/{}".format(
                            self.path_to_folder_images_smiles, name_image),
                        id=":{}:".format(name_image.split(".")[0]),
                        size_hint=(.09, .12))
                smile.bind(on_press=self.events_callback)
                smiles_box.add_widget(smile)

        self.smiles.add_widget(smiles_box)
        accordion.add_widget(self.smiles)

        # Панель форматирования и поле ввода.
        text = AccordionItem(title=self.accordion_panel_text_title,
                             background_selected=self.background_selected,
                             background_normal=self.background_normal)
        content = BoxLayout(orientation="vertical")

        # TODO: Слишком маленькие иконки на панели форматирования текста.
        # Сделать иконки в два ряда.
        if platform == "android":
            size_hint = (1, .12)
        else:
            size_hint = (1, .06)

        formats_panel = BoxLayout(size_hint=size_hint)

        # Иконки форматирования.
        for name_image in self.list_images_for_format_text:
            format_button = \
                ImageButton(id=os.path.split(name_image)[1].split(".")[0],
                            source=name_image)
            format_button.bind(on_press=self.events_callback)
            formats_panel.add_widget(format_button)

        self.text_input = TextInput(hint_text=self.hint_text,
                                    size_hint=(1, .4), auto_indent=True)
        if self.default_text != "":
            self.text_input.text = self.default_text

        content.add_widget(formats_panel)
        content.add_widget(self.text_input)
        text.add_widget(content)
        accordion.add_widget(text)

        # Подписи и чекбоксы.
        message_to = GridLayout(cols=2, size_hint=(1, .22), spacing=5)

        if self.forum == "mail":
            message_to.add_widget(Label(text=self.label_priority,
                                        markup=True))
            message_to.add_widget(Widget())

            message_to.add_widget(Label(text=self.priority_low))
            self.low_check = \
                CheckBox(background_radio_down=self.background_radio_down,
                         background_radio_normal=self.background_radio_normal,
                         id="low", group="priority")
            self.low_check.bind(active=self.events_callback)
            message_to.add_widget(self.low_check)

            message_to.add_widget(Label(text=self.priority_normal))
            self.normal_check = \
                CheckBox(background_radio_down=self.background_radio_down,
                         background_radio_normal=self.background_radio_normal,
                         active=True, id="normal", group="priority")
            self.normal_check.bind(active=self.events_callback)
            message_to.add_widget(self.normal_check)

            message_to.add_widget(Label(text=self.priority_tall))
            self.tall_check = \
                CheckBox(background_radio_down=self.background_radio_down,
                         background_radio_normal=self.background_radio_normal,
                         id="tall", group="priority")
            self.tall_check.bind(active=self.events_callback)
            message_to.add_widget(self.tall_check)

        additional = GridLayout(cols=2, size_hint=(1, .22), spacing=5)

        if self.forum == "mail":
            additional.add_widget(Label(text=self.label_report,
                                        markup=True))
            additional.add_widget(Widget())

            additional.add_widget(Label(text=self.save_in_sent))
            self.save_in_sent_check = \
                CheckBox(
                    background_checkbox_down=self.background_checkbox_down,
                    background_checkbox_normal=self.background_checkbox_normal,
                    active=True, id="save in sent")
            self.save_in_sent_check.bind(active=self.events_callback)
            additional.add_widget(self.save_in_sent_check)

            additional.add_widget(Label(text=self.read_report))
            self.read_report_check = \
                CheckBox(
                    background_checkbox_down=self.background_checkbox_down,
                    background_checkbox_normal=self.background_checkbox_normal,
                    id="read report")
            self.read_report_check.bind(active=self.events_callback)
            additional.add_widget(self.read_report_check)

        self.add_files_label = Label(text=self.add_files)
        additional.add_widget(self.add_files_label)
        self.add_files_check = \
            CheckBox(
                background_checkbox_down=self.background_checkbox_down,
                background_checkbox_normal=self.background_checkbox_normal,
                id="add files",)
        self.add_files_check.bind(active=self.events_callback)
        additional.add_widget(self.add_files_check)

        # Кнопки выбора.
        button_panel = BoxLayout(size_hint=(1, .15))
        for name_button in [self.text_button_ok, self.text_button_cancel]:
            select_button = Button(text=name_button, size_hint=(1, 1),
                                   id=name_button)
            select_button.bind(on_press=self.events_callback)
            button_panel.add_widget(select_button)

        self.add_widget(accordion)

        self.add_widget(Widget(size_hint=(None, .02)))
        if self.forum == "mail":
            self.add_widget(message_to)
        self.add_widget(Widget(size_hint=(None, .02)))
        self.add_widget(SettingSpacer())

        self.add_widget(additional)
        self.add_widget(Widget(size_hint=(None, .02)))
        self.add_widget(SettingSpacer())
        self.add_widget(Widget(size_hint=(None, .02)))

        self.add_widget(button_panel)

        self.body = Popup(title=self.title, content=self, size_hint=(.9, .99),
                          background=self.background_image)
        self.body.open()
class AbilityMenu(Screen):
    def __init__(self, **kwargs):
        super(AbilityMenu, self).__init__(**kwargs)

        self.root = Accordion(orientation='vertical')
        self.invItem = AccordionItem(title='Item')
        self.root.add_widget(self.invItem)
        self.targItem = AccordionItem(title='Target')
        self.root.add_widget(self.targItem)
        self.conItem = AccordionItem(title='Confirm')
        self.root.add_widget(self.conItem)
        B = Button(text='Confirm')
        B2 = Button(text='Cancel')
        B.bind(on_press=self.confirmTarget)
        B2.bind(on_press=self.cancel)
        self.conItem.add_widget(B)
        self.conItem.add_widget(B2)
        self.add_widget(self.root)

    def populateItems(self):
        self.ItemButtons = []
        for item in Combatants.get(0).inventory:
            if item.quantity > 0:
                btn = ToggleButton(text=item.name, group='items')
                self.invItem.add_widget(btn)
                self.ItemButtons.append(btn)

    def populateTargs(self):
        self.ComButtons = []
        for c in Combatants.retList():
            btn = ToggleButton(text=c.name, group='targets')
            self.targItem.add_widget(btn)
            self.ComButtons.append(btn)

    def confirmTarget(self, obj):
        hasTarget = False
        hasItem = False
        itemNum = None
        i = 0
        for a in self.ItemButtons:
            if a.state == 'down':
                hasItem = True
                itemNum = i
            i += 1
        i = 0
        for b in self.ComButtons:
            if b.state == 'down':
                hasTarget = True
                Screens[2].Target = Combatants.get(i)
            i += 1
        if hasTarget == True and hasItem == True:
            hasTarget = False
            hasItem = False
            self.targItem.clear_widgets(children=self.ComButtons)
            self.ComButtons.clear()
            self.invItem.clear_widgets(children=self.ItemButtons)
            self.ItemButtons.clear()
            Combatants.get(0).abilitiesUsed = Combatants.get(0).abilitiesUsed + 1
            Screens[2].AbilityButton.disabled = True
            self.manager.current = 'Battle Screen'
            Screens[2].UseItem(itemNum)

    def cancel(self, obj):
        self.targItem.clear_widgets(children=self.ComButtons)
        self.ComButtons.clear()
        self.invItem.clear_widgets(children=self.ItemButtons)
        self.ItemButtons.clear()
        self.manager.current = 'Battle Screen'
Beispiel #56
0
class ProcessingZ(BoxLayout):


    size_accordeon_scroll = ObjectProperty(None)
    lang = ObjectProperty(None)
    openPampaMT = ObjectProperty(None)


    def __init__(self, list_site, project, **kwargs):

        super(ProcessingZ, self).__init__(**kwargs)

        self.ids.bt_processingZ.text = self.lang['ProcessingZ']
        self.ids.bt_cancel.text = self.lang['Cancel']

        self.list_sites = list_site

        self.project = project

        for site in list_site:

            self.site_acordion = AccordionItem()


            self.site_acordion.title = site.name
            self.site_acordion.min_space = 25

            self.make_file_band_asc(site)

            if site.equipment == 'ADU06':
                view_files_asc06 = ViewFilesAscADU06(band=self.lang['Band'], get_band=self.change_tabs)
                view_files_asc06.site = site.name
                view_files_asc06.equipment = site.equipment
                self.site_acordion.add_widget(view_files_asc06)

            elif site.equipment == 'ADU07':

                view_files_asc07 = ViewFilesAscADU07(band=self.lang['Band'], get_band=self.change_tabs)
                view_files_asc07.site = site.name
                view_files_asc07.equipment = site.equipment
                self.site_acordion.add_widget(view_files_asc07)

            self.ids.accor_sites.add_widget(self.site_acordion)



    # d = TabbedPanel()
    # d.clear_tabs()
    # d.cl
    def change_tabs(self, band, site, equipment):

        self.ids.tab_asc.clear_tabs()
        self.ids.tab_asc.clear_widgets()

        for file_asc in list_file_asc:
            if (file_asc.site == site) and (file_asc.equipment == equipment) and (file_asc.band == band):

                tab_file_asc = TabItemFilesAsc(file_asc=file_asc, lang=self.lang)


                if equipment == 'ADU07':
                    self.ids.tab_asc.tab_width = 230

                self.ids.tab_asc.add_widget(tab_file_asc)

        print('Select Band: ' + band)
        print('Select Site: ' + site)
        print('Select Equipment: ' + equipment)
        print('')

    def make_file_band_asc(self, site):

        if site.equipment == 'ADU06':
            path_band_asc_site = user + '/PampaMT/PROC_MT/' + site.project + '/PampaMT/band_asc/' + site.name
            if os.path.isdir(path_band_asc_site):
                pass
            else:
                os.mkdir(path_band_asc_site)

            # Band A
            print('Band A')
            path_band_asc_site_bandA = path_band_asc_site + '/band_A'

            if os.path.isdir(path_band_asc_site_bandA):
                pass
            else:
                os.mkdir(path_band_asc_site_bandA)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*A.asc')
            path_file_asc = sorted(path_file_asc)

            for path_asc in path_file_asc:

                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = 'A'

                list_file_asc.append(object_file_asc)



                arq_asc = open(path_band_asc_site_bandA + '/' + file_asc, 'w')
                arq_asc.write(file_asc + ' 65536 ss;bs1\n')
                arq_asc.close()

                print(file_asc)

            # Band B
            print('Band B')
            path_band_asc_site_bandB = path_band_asc_site + '/band_B'

            if os.path.isdir(path_band_asc_site_bandB):
                pass
            else:
                os.mkdir(path_band_asc_site_bandB)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*B.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = 'B'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_bandB + '/' + file_asc, 'w')
                arq_asc.write(file_asc + ' 65536 ss\n')
                arq_asc.write(file_asc + '  8192 ss\n')
                arq_asc.close()

                print(file_asc)

            # Band F
            print('Band F')
            path_band_asc_site_bandF = path_band_asc_site + '/band_F'

            if os.path.isdir(path_band_asc_site_bandF):
                pass
            else:
                os.mkdir(path_band_asc_site_bandF)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*F.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = 'F'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_bandF + '/' + file_asc, 'w')
                arq_asc.write(file_asc + ' 16384 ss\n')
                arq_asc.write(file_asc + '  8192 ss\n')
                arq_asc.close()

                print(file_asc)

            # Band C
            print('Band C')
            path_band_asc_site_bandC = path_band_asc_site + '/band_C'

            if os.path.isdir(path_band_asc_site_bandC):
                pass
            else:
                os.mkdir(path_band_asc_site_bandC)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*C.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = 'C'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_bandC + '/' + file_asc, 'w')
                arq_asc.write(file_asc + '   256 ss\n')
                arq_asc.write(file_asc + '   128 ss\n')
                arq_asc.close()

                print(file_asc)

            # Band D
            print('Band D')
            path_band_asc_site_bandD = path_band_asc_site + '/band_D'

            if os.path.isdir(path_band_asc_site_bandD):
                pass
            else:
                os.mkdir(path_band_asc_site_bandD)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*D.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = 'D'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_bandD + '/' + file_asc, 'w')
                arq_asc.write(file_asc + '   128 ss\n')
                arq_asc.write(file_asc + '    64 ss\n')
                arq_asc.close()

                print(file_asc)

        if site.equipment == 'ADU07':
            path_band_asc_site = user + '/PampaMT/PROC_MT/' + site.project + '/PampaMT/band_asc/' + site.name
            if os.path.isdir(path_band_asc_site):
                pass
            else:
                os.mkdir(path_band_asc_site)

            # Band 65536H
            print('Band 65536H')
            path_band_asc_site_band65536H = path_band_asc_site + '/band_65536H'

            if os.path.isdir(path_band_asc_site_band65536H):
                pass
            else:
                os.mkdir(path_band_asc_site_band65536H)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*65536H.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = '65536H'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_band65536H + '/' + file_asc, 'w')
                arq_asc.write(file_asc + ' 65536 ss;bs1\n')
                arq_asc.write(file_asc + ' 32768 ss\n')
                arq_asc.close()

                print(file_asc)

            # Band 4096H
            print('Band 4096H')
            path_band_asc_site_band4096H = path_band_asc_site + '/band_4096H'

            if os.path.isdir(path_band_asc_site_band4096H):
                pass
            else:
                os.mkdir(path_band_asc_site_band4096H)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*4096H.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = '4096H'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_band4096H + '/' + file_asc, 'w')
                arq_asc.write(file_asc + ' 65536 ss\n')
                arq_asc.write(file_asc + '  8192 ss\n')
                arq_asc.close()

                print(file_asc)

            # Band 128H
            print('Band 128H')
            path_band_asc_site_band128H = path_band_asc_site + '/band_128H'

            if os.path.isdir(path_band_asc_site_band128H):
                pass
            else:
                os.mkdir(path_band_asc_site_band128H)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*128H.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = '128H'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_band128H + '/' + file_asc, 'w')
                arq_asc.write(file_asc + '   256 ss\n')
                arq_asc.write(file_asc + '   128 ss\n')
                arq_asc.close()

                print(file_asc)

            # Band 4H
            print('Band 4H')
            path_band_asc_site_band4H = path_band_asc_site + '/band_4H'

            if os.path.isdir(path_band_asc_site_band4H):
                pass
            else:
                os.mkdir(path_band_asc_site_band4H)

            path_file_asc = glob.glob(user + '/PampaMT/PROC_MT/' + site.project + '/DATA/' + site.name + '*4H.asc')
            path_file_asc = sorted(path_file_asc)
            for path_asc in path_file_asc:
                file_asc = os.path.basename(path_asc)

                object_file_asc = FileAsc()
                object_file_asc.name = file_asc
                object_file_asc.site = site.name
                object_file_asc.equipment = site.equipment
                object_file_asc.project = site.project
                object_file_asc.band = '4H'

                list_file_asc.append(object_file_asc)

                arq_asc = open(path_band_asc_site_band4H + '/' + file_asc, 'w')
                arq_asc.write(file_asc + '   128 ss\n')
                arq_asc.write(file_asc + '    64 ss\n')
                arq_asc.close()

                print(file_asc)

        site.files_asc = list_file_asc


    def cancel_processingZ(self):
        self.break_processingZ = True

    def open_popup_processingZ(self):

        self.pop_processingZ = PopUpLoading(title_pop='ProcessingZ...', lang_seconds='segundos', lang_minutes='minutos',
                                            lang_cancel='cancel', cancel=self.cancel_processingZ)

        self.pop_processingZ.width = 350

        num_file = len(list_file_asc)

        self.pop_processingZ.open()



        self.pop_processingZ.num_max = num_file
        self.pop_processingZ.papallel_start(self.processingZ)


    def processingZ(self):

        self.break_processingZ = False
        number_file = 1



        for file_asc in list_file_asc:
            time_go = timer()

            if self.break_processingZ == False and file_asc.processingZ == False:

                processingZ = 'PampaMT/band_asc/' + file_asc.site + '/band_' + file_asc.band + '/' + file_asc.name
                time.sleep(1)
                os.system('processamentoZ ' + processingZ)
                file_asc.processingZ = True


                # Save in ppmt file
                self.project.sites = self.list_sites
                #self.project.save()
                save(self.project)

                print(processingZ)
            else:
                print('cancelando..')

                self.pop_processingZ.dismiss()
                break

            self.pop_processingZ.count_time = number_file
            time_end = timer()
            self.pop_processingZ.time_one_step = time_end - time_go
            number_file += 1
            self.pop_processingZ.title = self.pop_processingZ.title_pop + '      ' + file_asc.name

        if self.break_processingZ == False:
            self.pop_processingZ.dismiss()
            self.open_PampaMT()

    def open_PampaMT(self):

        print('salvar, gerar os arquivo para plotar , e abrir o pampa mt')
        # print(self.list_sites)

        self.openPampaMT(self.project)
Beispiel #57
0
    def addTab(self, name, obj):
    	th = AccordionItem(title=name)
    	self.add_widget(th)
	th.add_widget(obj)
	return th
Beispiel #58
0
def main_menu():
        #Window.fullscreen=True
        Window.clearcolor=(1,140.0/255,15.0/255,0)
        Menu=BoxLayout(orientation='vertical')
        title = Label(
            text='Trages',
            markup=True,
            bold=True,
            color=(79.0/255,15.0/255,204.0/255,0),
            font_name='RAVIE.ttf',
            font_size='100dp',
            y=Window.height/2-25,
            x=-Window.width/2+100,
            size_hint=(1,0.3)
        )
        Menu.add_widget(title)
        
        root=Accordion(orientation='vertical')

        ButtonChildren=Button(text='Press here for children education',size_hint=(1,0.3))
        ButtonChildren.bind(on_press=go_children)

        s1='This version of software\n is a new method of \nteaching children.\n It allows one to make \nlearning process \nmore interactive and \nsimple due to gaming form.'
        LabelChildren=Label(text=s1, font_name='RAVIE.ttf',font_size='20dp',max_lines=4,shorten=True,color=(113.0/255,17.0/255,150.0/255,1))       
        BoxLayoutChildren=BoxLayout(orientation='horizontal')
        BoxLayoutChildren2=BoxLayout(orientation='vertical')
        BoxLayoutChildren2.add_widget(LabelChildren)
        BoxLayoutChildren2.add_widget(ButtonChildren)
        ImageChildren=Image(source='childeduc.bmp')
        BoxLayoutChildren.add_widget(ImageChildren)
        BoxLayoutChildren.add_widget(BoxLayoutChildren2)
        
        children=AccordionItem(title='Children Education')      
        children.add_widget(BoxLayoutChildren)
        
        ###
        ButtonGame=Button(text='Press here for testing',size_hint=(1,.3))
        ButtonGame.bind(on_press=go_game)
        s2='This version of software\n is a new method of \ntesting children.\n It allows one to make \ntesting process \nmore interactive and \nsimple due to gaming form.'
        LabelGame=Label(text=s2, font_name='RAVIE.ttf',font_size='20dp',max_lines=4,shorten=True,color=(113.0/255,17.0/255,150.0/255,1))       
        BoxLayoutGame=BoxLayout(orientation='horizontal')
        BoxLayoutGame2=BoxLayout(orientation='vertical')
        BoxLayoutGame2.add_widget(LabelGame)
        BoxLayoutGame2.add_widget(ButtonGame)
        ImageGame=Image(source='forgame.bmp')
        BoxLayoutGame.add_widget(ImageGame)
        BoxLayoutGame.add_widget(BoxLayoutGame2)
                                 
        game=AccordionItem(title='Game!')
        game.add_widget(BoxLayoutGame)
        ###     
        BoxLayoutInfo=BoxLayout(orientation='horizontal')
        ImageInfo=Image(source='command.jpg')
        BoxLayoutInfo.add_widget(ImageInfo)
        LabelInfo=Label(text='We are command from \nN.Novgorod,Russia.\nWe are Max and Anna.\nWe want to help \ndeaf-mute people,\nso we created\n this application.',font_size='25dp',font_name='RAVIE.ttf',color=(113.0/255,17.0/255,150.0/255,1))
        BoxLayoutInfo.add_widget(LabelInfo)
        info=AccordionItem(title='About us')
        info.add_widget(BoxLayoutInfo)

        ButtonExit=Button(text='Exit')
        ButtonExit.bind(on_press=go_exit)
        ButtonExit.size_hint=(1,.1)

        #rexit=AccordionItem(title='Exit')
        #rexit.add_widget(ButtonExit)
        
        root.add_widget(children)
        root.add_widget(game)
        root.add_widget(info)
        #root.add_widget(rexit)
        root.current=children
        Menu.add_widget(root)
        Menu.add_widget(ButtonExit)

        return Menu
Beispiel #59
0
class UploadFiles(GridLayout):
    event_callback = ObjectProperty(p)
    data_callback = ObjectProperty(p)
    """Принимает словарь данных о выборе пользователя."""
    background_selected = StringProperty(
        "atlas://data/images/defaulttheme/button_pressed")
    background_normal = StringProperty(
        "atlas://data/images/defaulttheme/button")
    background_image = StringProperty(
        "atlas://data/images/defaulttheme/modalview-background")
    """Фоновое изображение окна."""
    title = StringProperty("Add File")
    title_step = StringProperty("Add File")
    # Подписи вкладок аккордиона.
    panel_step_one_text = StringProperty("Step One: Select section")
    panel_step_two_text = StringProperty("Step Two: Select category")
    panel_step_three_text = StringProperty("Step Three: Select file")
    text_terms = StringProperty("Step One\n-------------------")
    sections_files = DictProperty({})

    def __init__(self, **kvargs):
        super(UploadFiles, self).__init__(**kvargs)
        self.__data = {
            "zip": False,  # упаковывать ли файл в zip
            "name": "",  # имя файла
            "version": "",  # версия файла
            "description": "",  # описание файла
            "file": "",  # путь к файлу
            "screenshot": ""  # путь к изображению скриншота
        }

        self.cols = 1
        self.spacing = 17

        self.label_form = Label(text=self.title_step, font_size=20,
                                size_hint=(1, .05), markup=True)
        accordion = Accordion(orientation="vertical")
        # --------------------STEP-ONE----------------------
        self.step_one = \
            AccordionItem(title=self.panel_step_one_text,
                          background_selected=self.background_selected,
                          background_normal=self.background_normal)

        scroll_view_one = ScrollView()
        sections = GridLayout(cols=1, spacing=17, size_hint_y=None)
        sections.bind(minimum_height=sections.setter("height"))
        sections.add_widget(SettingSpacer())

        for section_name in self.sections_files.keys():
            sections.add_widget(
                Label(text="[color=#2fbfe0][ref={section_name}]{section_name}"
                           "[/ref][/color]".format(section_name=section_name),
                      on_ref_press=self.event_callback, markup=True))
            sections.add_widget(SettingSpacer())

        scroll_view_one.add_widget(sections)
        self.step_one.add_widget(RstDocument(text=self.text_terms))
        self.step_one.add_widget(scroll_view_one)
        # --------------------STEP-TWO----------------------
        self.step_two = \
            AccordionItem(title=self.panel_step_two_text,
                          background_selected=self.background_selected,
                          background_normal=self.background_normal)

        self.scroll_view_two = ScrollView()
        self.sub_sections = GridLayout(cols=1, spacing=17, size_hint_y=None)
        self.sub_sections.bind(
            minimum_height=self.sub_sections.setter("height"))
        self.sub_sections.add_widget(SettingSpacer())

        self.step_two.disabled = True
        # --------------------STEP-THREE----------------------
        self.step_three = \
            AccordionItem(title=self.panel_step_three_text,
                          background_selected=self.background_selected,
                          background_normal=self.background_normal)

        self.scroll_view_three = ScrollView()
        self.select_file = GridLayout(cols=1, spacing=17, size_hint_y=None)
        self.select_file.bind(minimum_height=self.select_file.setter("height"))
        self.select_file.add_widget(SettingSpacer())

        self.step_three.disabled = True
        # ----------------------------------------------------
        accordion.add_widget(self.step_one)
        accordion.add_widget(self.step_two)
        accordion.add_widget(self.step_three)
        self.add_widget(self.label_form)
        self.add_widget(accordion)

        self.body = Popup(title=self.title, content=self, size_hint=(.9, .99),
                          background=self.background_image)
        self.body.open()

        # Открываем панель "Шаг Первый".
        self.step_one.collapse = False

    def _choice_file(self, *args):
        def set_file(*args):
            path_to__file = args[1][0]
            self.__data[button_id] = path_to__file
            file_manager.body.dismiss()

            name_file = os.path.split(path_to__file)[1]

            if button_id == "file":
                self.button_add_file.text = name_file
            elif button_id == "screenshot":
                self.button_add_screenshot.text = name_file

        button_id = args[0].id

        if FileChooser:
            file_manager = FileChooser(title=self.title,
                                       select_callback=set_file)
        else:
            raise ImportError("No module named filechooser")

    def show_step_two(self, text_terms, sub_sections_files,
                      select_sub_section):
        """Наполняет контентом вкладку 'Шаг Второй'."""

        for sub_section_name in sub_sections_files.keys():
            self.sub_sections.add_widget(Label(
                text="[color=#2fbfe0][ref={sub_section_name}]"
                     "{sub_section_name}"
                     "[/ref]".format(sub_section_name=sub_section_name),
                on_ref_press=select_sub_section, markup=True))
            self.sub_sections.add_widget(SettingSpacer())

        self.scroll_view_two.add_widget(self.sub_sections)
        self.step_two.add_widget(RstDocument(text=text_terms))
        self.step_two.add_widget(self.scroll_view_two)

        self.step_two.disabled = False
        self.step_two.collapse = False  # открываем панель "Шаг Второй"

    def show_step_three(self, section_title, sub_section_title,
                        legal_files_title, legal_files_str,
                        add_screenshot_title, select_file_title,
                        add_file_title,
                        name_file_title, version_file_title, description_title,
                        zip_pack_title, send_title):
        """Наполняет контентом вкладку 'Шаг Третий'."""

        def _data_callback(*args):
            self.__data["zip"] = switch.active
            self.__data["name"] = name_file.text
            self.__data["version"] = version_file.text
            self.__data["description"] = description_file.text

            self.data_callback(self.__data)

        print("this 2")
        # Вы добавляете файл в раздел такой-то
        # Категорию такую-то
        # Допустимые форматы файлов
        # ".xap", ".flv", ".pdf", ".apk" ...
        label_select_section = Label(text=section_title, font_size=20,
                                     markup=True)
        label_select_sub_section = Label(text=sub_section_title, markup=True)
        label_legal_files = Label(text=legal_files_title, markup=True)
        legal_files_ext = Label(text=legal_files_str, markup=True)
        legal_files_ext.bind(size=lambda *args: self._update_window_size(args))

        # Добавить скриншот           Добавить файл
        # -----------------          -----------------
        # | Выбрать файл  |          | Выбрать файл  |
        # -----------------          -----------------
        box_add_content = BoxLayout(size_hint_y=None, height=60)
        box_add_screenshot = BoxLayout(orientation="vertical",
                                       size_hint_y=None)
        label_add_screenshot = Label(text=add_screenshot_title, markup=True)
        # label_add_screenshot.bind(size=lambda *args: self._update_window_size(args))
        self.button_add_screenshot = Button(text=select_file_title,
                                            size_hint=(1, 1),
                                            on_press=self._choice_file,
                                            id="screenshot")

        box_add_file = BoxLayout(orientation="vertical", size_hint_y=None)
        label_add_file = Label(text=add_file_title, id="add_file", markup=True)
        # label_add_file.bind(size=lambda *args: self._update_window_size(args))
        self.button_add_file = Button(text=select_file_title, size_hint=(1, 1),
                                      on_press=self._choice_file, id="file")

        #     Имя файла                Версия файла
        # -----------------          -----------------
        # |               |          |               |
        # -----------------          -----------------
        box_info_file = BoxLayout(size_hint_y=None, height=70)
        box_name_file = BoxLayout(orientation="vertical", size_hint_y=None)
        label_name_file = Label(text=name_file_title, markup=True)
        name_file = TextInput(size_hint=(1, 1), id="name")

        box_version_file = BoxLayout(size_hint_y=None, orientation="vertical")
        label_version_file = Label(text=version_file_title, markup=True)
        version_file = TextInput(size_hint=(1, 1), id="version")

        #           Описание файла
        # ----------------------------------
        # |                                |
        # ----------------------------------
        label_description_file = Label(text=description_title, markup=True)
        description_file = TextInput(size_hint_y=None, id="description")

        # Упаковать в zip-архив
        #       --------
        #       |ON|   |
        #       --------
        label_zip_pack = Label(text=zip_pack_title, markup=True,
                               size_hint_y=None, height=55)
        box_zip_pack = BoxLayout(orientation="vertical", size_hint_y=None,
                                 height=40)
        switch = Switch(size_hint_y=None, height=15)

        # ----------------------------------
        # |           Отправить            |
        # ----------------------------------
        box_send = BoxLayout(size_hint_y=None, height=50)
        button_send = Button(text=send_title, on_press=_data_callback)

        box_add_screenshot.add_widget(label_add_screenshot)
        box_add_screenshot.add_widget(self.button_add_screenshot)

        box_add_file.add_widget(label_add_file)
        box_add_file.add_widget(self.button_add_file)
        box_add_content.add_widget(box_add_screenshot)
        box_add_content.add_widget(box_add_file)

        box_send.add_widget(button_send)

        box_zip_pack.add_widget(label_zip_pack)
        box_zip_pack.add_widget(switch)

        box_version_file.add_widget(label_version_file)
        box_version_file.add_widget(version_file)
        box_name_file.add_widget(label_name_file)
        box_name_file.add_widget(name_file)

        box_info_file.add_widget(box_name_file)
        box_info_file.add_widget(box_version_file)

        self.select_file.add_widget(label_select_section)
        self.select_file.add_widget(SettingSpacer())
        self.select_file.add_widget(label_select_sub_section)
        self.select_file.add_widget(SettingSpacer())

        self.select_file.add_widget(label_legal_files)
        self.select_file.add_widget(Widget(size_hint=(1, .1)))
        self.select_file.add_widget(legal_files_ext)
        self.select_file.add_widget(Widget(size_hint=(1, .1)))
        self.select_file.add_widget(SettingSpacer())

        self.select_file.add_widget(Widget(size_hint=(1, .1)))
        self.select_file.add_widget(box_add_content)
        self.select_file.add_widget(SettingSpacer())

        self.select_file.add_widget(box_info_file)
        self.select_file.add_widget(SettingSpacer())

        self.select_file.add_widget(label_description_file)
        self.select_file.add_widget(description_file)
        self.select_file.add_widget(SettingSpacer())

        self.select_file.add_widget(box_zip_pack)
        self.select_file.add_widget(SettingSpacer())

        self.select_file.add_widget(box_send)

        self.scroll_view_three.add_widget(self.select_file)
        self.step_three.add_widget(self.scroll_view_three)

        self.step_three.disabled = False
        self.step_three.collapse = False  # открываем панель "Шаг Третий"

    def _update_window_size(self, *args):
        label = args[0][0]
        width = args[0][1][0]
        height = 40

        label.text_size = (width - 30, height)