Beispiel #1
0
    def __init__(self,**kwargs):
        super(Medicine,self).__init__(**kwargs)
        self.active_checkboxes = []
        self.checkboxeslist = []
        self.scrollsize = fullapp.size[0]*0.86,fullapp.size[1]*0.57
        self.scrollpos = fullapp.size[0]*0.07,fullapp.size[1]*0.34

        self.canvas.add(Rectangle(size=fullapp.size,pos=fullapp.pos,source="MainBackgroundWhiter.png"))
        self.add_widget(MenuButton())
        rect = Rectangle(size=(fullapp.size[0],fullapp.size[1]*0.236),pos=fullapp.pos,source='FrontForScroll.png')
        self.canvas.add(rect)
        self.canvas.add(Color(0.5,0.5,0.5,1))
        self.canvas.add(Rectangle(size=self.scrollsize,pos=self.scrollpos))

        MedScroll = ScrollView()
        MedScroll.size_hint = (None,None)
        MedScroll.size = self.scrollsize
        MedScroll.pos = self.scrollpos

        MedBox = Widget()
        MedBox.size_of_drug = (self.scrollsize[0],fullapp.size[1]*0.1)
        MedBox.spacing = fullapp.size[1]*0.01
        MedBox.size = (self.scrollsize[0],(MedBox.spacing+MedBox.size_of_drug[1])*len(IlnessBase.Medicine)-MedBox.spacing)
        MedBox.size_hint_y = None

        for i in range(len(IlnessBase.Medicine)):
            text = Label(color=(1,1,1,1),markup=True)
            text.text = IlnessBase.Medicine[i][:IlnessBase.Medicine[i].find(':')] + '  ' + '[i][size=11][color=272727]' + 'ATX num ' + IlnessBase.Medicine[i][IlnessBase.Medicine[i].find(':')+1:] + '[/i][/size][/color]'
            text.text_size = MedBox.size_of_drug
            text.text_size[0] -= MedBox.size_of_drug[1]
            text.halign = 'left'
            text.valign = 'middle'
            text.pos = (MedBox.size_of_drug[0]/4.3,i*(MedBox.spacing+MedBox.size_of_drug[1])-MedBox.size_of_drug[1]/2)
            b = Button(size=MedBox.size_of_drug,pos=(0,i*(MedBox.spacing+MedBox.size_of_drug[1])))
            b.bind(on_press=self.on_button)
            b.add_widget(text)
            checkbox = CheckBox(size=(MedBox.size_of_drug[1],MedBox.size_of_drug[1]),pos = (MedBox.size_of_drug[0]-MedBox.size_of_drug[1],i*(MedBox.spacing+MedBox.size_of_drug[1])))
            checkbox.num = i
            checkbox.bind(active=self.on_checkbox)
            b.add_widget(checkbox)
            self.checkboxeslist.append(checkbox)
            b.ATXNum = IlnessBase.Medicine[i][IlnessBase.Medicine[i].find(':')+1:]
            MedBox.add_widget(b)

        TopLabel = Label(bold=True,size_hint=(None,None),text='check prep:',font_size=fullapp.size[1]*0.036,color = (0,0,0,1),pos = (fullapp.size[0]*0.34,fullapp.size[1]*0.85))
        
        self.SomeWidget = Widget(pos=(0,0),size_hint=(None,None),size = fullapp.size)
        CancelButton = Button(text = 'exit',font_size=fullapp.size[1]*0.022,size_hint=(None,None),size=(MedBox.size_of_drug[0]/2.01,fullapp.size[1]*0.05),
            pos = (self.scrollpos[0],self.scrollpos[1]-fullapp.size[1]*0.05-1),background_color = (0.3,0.3,0.9,1),on_press=self.on_cancel)
        OkButton = Button(text = 'chose',font_size=fullapp.size[1]*0.022,size_hint=(None,None),size=(MedBox.size_of_drug[0]/2.01,fullapp.size[1]*0.05),
            pos = (self.scrollpos[0]+MedBox.size_of_drug[0]/2+1,self.scrollpos[1]-fullapp.size[1]*0.05-1),background_color = (0.3,0.3,0.9,1),on_press=self.on_choose)
        
        self.SomeWidget.add_widget(CancelButton)
        self.SomeWidget.add_widget(OkButton)
        self.SomeWidget.opacity=0

        MedScroll.add_widget(MedBox)
        self.add_widget(self.SomeWidget)
        self.add_widget(MedScroll)
        self.add_widget(TopLabel)
Beispiel #2
0
    def SCROLL(self, *args):
        global MascaraS
        global vistaScroll
        global textoScroll
        textoScroll = Widget()
        MascaraS = GridLayout(cols=2, spacing=2, size_hint_y=None, size_hint_x = None, size=(250,100))
        # Make sure the height is such that there is something to scroll.
        MascaraS.bind(minimum_height=MascaraS.setter('height'))
        vistaScroll = ScrollView(size_hint=(None, None), size = (260,150))
        vistaScroll.add_widget(MascaraS)
        vistaScroll.pos = 465, 105
        #root.size = 20, 40

        Mprincipal.add_widget(textoScroll)
        Mprincipal.add_widget(vistaScroll)
Beispiel #3
0
    def __init__(self, **kwargs):
        super(Literature, self).__init__(**kwargs)

        global fullapp,LitScroll
        self.canvas.add(Rectangle(size=fullapp.size,pos=fullapp.pos,source="MainBackgroundWhiter.png"))
        self.add_widget(MenuButton())
        rect = Rectangle(size=(fullapp.size[0],fullapp.size[1]*0.236),pos=fullapp.pos,source='FrontForScroll.png')
        self.canvas.add(rect)

        self.scrollsize = fullapp.size[0]*0.86,fullapp.size[1]*0.6
        self.scrollpos = fullapp.size[0]*0.07,fullapp.size[1]*0.27
        self.libra = IlnessBase.Literature
        self.opened_divisions = [0 for i in range(len(self.libra.keys())+6)]

        LitScroll = ScrollView()
        LitScroll.size_hint = (None,None)
        LitScroll.pos = self.scrollpos
        LitScroll.size = self.scrollsize
        LitScroll.add_widget(self.create_literature())
        self.add_widget(LitScroll)
        self.add_widget(Label(text = '[color=000033]'+'litra.'+'[/color]',bold= True,font_size = fullapp.size[1]*0.038,pos=(0,fullapp.size[1]*0.44),markup = True))#,pos = (fullapp.size[0]*0.3,fullapp.size[1]*0.8)))
Beispiel #4
0
    def __init__(self, **kwargs):
        super(AudioListWidget, self).__init__(**kwargs)

        layout = GridLayout(cols=1, spacing=0, size_hint_y=None)
        layout.bind(minimum_height=layout.setter('height'))
        audio_list = glob.glob("./*.wav")
        for audio_filename in audio_list:
            btn = Button(text=audio_filename, size_hint_y=None, height=40)
            btn.bind(on_press=self.audio_select)
            layout.add_widget(btn)

        scroll_view = ScrollView(size_hint=(None, None),
                                 size=(200, Window.height))
        scroll_view.add_widget(layout)
        scroll_view.pos = (800, 0)

        self.add_widget(scroll_view)

        self.sound_stream = SoundStream(audio_list[0])
        self.sound_stream.setDaemon(True)
        self.sound_stream.start()

        global sound_stream
        sound_stream = self.sound_stream
Beispiel #5
0
    def _update_tabs(self, *l):
        self_content = self.content
        if not self_content:
            return
        # cache variables for faster access
        tab_pos = self.tab_pos
        tab_layout = self._tab_layout
        tab_layout.clear_widgets()
        scrl_v = ScrollView(size_hint=(None, 1))
        tabs = self._tab_strip
        parent = tabs.parent
        if parent:
            parent.remove_widget(tabs)
        scrl_v.add_widget(tabs)
        scrl_v.pos = (0, 0)
        self_update_scrollview = self._update_scrollview

        # update scrlv width when tab width changes depends on tab_pos
        if self._partial_update_scrollview is not None:
            tabs.unbind(width=self._partial_update_scrollview)
        self._partial_update_scrollview = partial(
            self_update_scrollview, scrl_v)
        tabs.bind(width=self._partial_update_scrollview)

        # remove all widgets from the tab_strip
        self.clear_widgets(do_super=True)
        tab_height = self.tab_height

        widget_list = []
        tab_list = []
        pos_letter = tab_pos[0]
        if pos_letter == 'b' or pos_letter == 't':
            # bottom or top positions
            # one col containing the tab_strip and the content
            self.cols = 1
            self.rows = 2
            # tab_layout contains the scrollview containing tabs and two blank
            # dummy widgets for spacing
            tab_layout.rows = 1
            tab_layout.cols = 3
            tab_layout.size_hint = (1, None)
            tab_layout.height = tab_height
            self_update_scrollview(scrl_v)

            if pos_letter == 'b':
                # bottom
                if tab_pos == 'bottom_mid':
                    tab_list = (Widget(), scrl_v, Widget())
                    widget_list = (self_content, tab_layout)
                else:
                    if tab_pos == 'bottom_left':
                        tab_list = (scrl_v, Widget(), Widget())
                    elif tab_pos == 'bottom_right':
                        #add two dummy widgets
                        tab_list = (Widget(), Widget(), scrl_v)
                    widget_list = (self_content, tab_layout)
            else:
                # top
                if tab_pos == 'top_mid':
                    tab_list = (Widget(), scrl_v, Widget())
                elif tab_pos == 'top_left':
                    tab_list = (scrl_v, Widget(), Widget())
                elif tab_pos == 'top_right':
                    tab_list = (Widget(), Widget(), scrl_v)
                widget_list = (tab_layout, self_content)
        elif pos_letter == 'l' or pos_letter == 'r':
            # left ot right positions
            # one row containing the tab_strip and the content
            self.cols = 2
            self.rows = 1
            # tab_layout contains two blank dummy widgets for spacing
            # "vertically" and the scatter containing scrollview
            # containing tabs
            tab_layout.rows = 3
            tab_layout.cols = 1
            tab_layout.size_hint = (None, 1)
            tab_layout.width = tab_height
            scrl_v.height = tab_height
            self_update_scrollview(scrl_v)

            # rotate the scatter for vertical positions
            rotation = 90 if tab_pos[0] == 'l' else -90
            sctr = Scatter(do_translation=False,
                           rotation=rotation,
                           do_rotation=False,
                           do_scale=False,
                           size_hint=(None, None),
                           auto_bring_to_front=False,
                           size=scrl_v.size)
            sctr.add_widget(scrl_v)

            lentab_pos = len(tab_pos)

            # Update scatter's top when it's pos changes.
            # Needed for repositioning scatter to the correct place after its
            # added to the parent. Use clock_schedule_once to ensure top is
            # calculated after the parent's pos on canvas has been calculated.
            # This is needed for when tab_pos changes to correctly position
            # scatter. Without clock.schedule_once the positions would look
            # fine but touch won't translate to the correct position

            if tab_pos[lentab_pos - 4:] == '_top':
                #on positions 'left_top' and 'right_top'
                sctr.bind(pos=partial(self._update_top, sctr, 'top', None))
                tab_list = (sctr, )
            elif tab_pos[lentab_pos - 4:] == '_mid':
                #calculate top of scatter
                sctr.bind(pos=partial(self._update_top, sctr, 'mid',
                                      scrl_v.width))
                tab_list = (Widget(), sctr, Widget())
            elif tab_pos[lentab_pos - 7:] == '_bottom':
                tab_list = (Widget(), Widget(), sctr)

            if pos_letter == 'l':
                widget_list = (tab_layout, self_content)
            else:
                widget_list = (self_content, tab_layout)

        # add widgets to tab_layout
        add = tab_layout.add_widget
        for widg in tab_list:
            add(widg)

        # add widgets to self
        add = self.add_widget
        for widg in widget_list:
            add(widg)
Beispiel #6
0
    def notify(self):
        def exit(instance):
            self.remove_widget(NotePopup)

        self.scrollsize = fullapp.size[0]*0.8,fullapp.size[1]*0.6
        self.scrollpos = fullapp.size[0]*0.095,fullapp.size[1]*0.185
        self.size_of_note = (self.scrollsize[0],fullapp.size[1]*0.25)

        NotePopup = Popup(size_hint=(None,None),size=(fullapp.size[0]*0.9,fullapp.size[1]*0.8))
        NotePopup.pos = (fullapp.size[0]/2 - NotePopup.size[0]/2,fullapp.size[1]/2 - NotePopup.size[1]/2)
        NotePopup.title = 'view pushers.'
        NotePopup.title_align = 'center'
        NotePopup.separator_color = (0.3,0.3,1,1)
        NotePopup.title_size = fullapp.size[1]*0.03

        NoteScroll = ScrollView()
        NoteScroll.size_hint = (None,None)
        NoteScroll.size = self.scrollsize
        NoteScroll.pos =self.scrollpos

        NoteBox = Widget()
        NoteBox.size_of_note = self.size_of_note
        NoteBox.spacing = fullapp.size[1]*0.006
        NoteBox.size = (self.scrollsize[0],(NoteBox.spacing+NoteBox.size_of_note[1])*len(fullapp.notes)-NoteBox.spacing)
        NoteBox.size_hint_y = None

        for i in range(len(fullapp.notes)):
            b = Button(size=self.size_of_note,pos=(-2,i*(NoteBox.spacing+NoteBox.size_of_note[1])))
            
            if(fullapp.notes[i]['type'] == 'request'):
                b.add_widget(Label(markup=True,text='[color=cccccc]'+'ok request number '+ '[b][/color]' + str(fullapp.notes[i]['idnum']) + '[/b]',font_size=fullapp.size[1]*0.03,color=(1,1,1,1),pos=(fullapp.size[0]*0.19,fullapp.size[1]*0.126+i*(NoteBox.spacing+NoteBox.size_of_note[1]))))
                if(fullapp.notes[i]['undertype']=='med'):
                    preparate =  IlnessBase.Medicine[fullapp.notes[i]['idinIlnessBase']]
                    print(preparate)
                    b.add_widget(Label(text_size=(self.size_of_note[0]*0.97,self.size_of_note[1]*0.7),markup=True,text='to adding preparate '+ '[b][i]' + preparate[:preparate.find(':')]\
                         + '[/b][/i]'+' seems ' + '[b][i]' + preparate[preparate.find(':')+1:] + '[/b][/i]'+' by systemATX.',font_size=fullapp.size[1]*0.03,color=(1,1,1,1),pos=(fullapp.size[0]*0.244,fullapp.size[1]*0.086+i*(NoteBox.spacing+NoteBox.size_of_note[1]))))
                    
                    if(fullapp.notes[i]['state']=='inprogress'):
                        b.add_widget(Label(text='[color=cccccc]Poss: [/color][b][color=adaddf]cheking[/color][b]',font_size=fullapp.size[1]*0.03,markup=True,pos=(fullapp.size[0]*0.184,-fullapp.size[1]*0.046+i*(NoteBox.spacing+NoteBox.size_of_note[1]))))

                    b.add_widget(Label(text='[color=353535]from '+ fullapp.notes[i]['date'],markup=True,font_size=fullapp.size[1]*0.025,pos=(fullapp.size[0]*0.384,-fullapp.size[1]*0.076+i*(NoteBox.spacing+NoteBox.size_of_note[1]))))
                
                elif(fullapp.notes[i]['undertype']=='ser'):
                    service =  fullapp.notes[i]['name']
                    print(service)
                    b.add_widget(Label(text_size=(self.size_of_note[0],self.size_of_note[1]*0.7),markup=True,text='To add new usluga '+ '[b][i]' + service\
                         + '[/b][/i]'+ '[/b][/i]'+'.   Check info to usluga.',font_size=fullapp.size[1]*0.03,color=(1,1,1,1),pos=(fullapp.size[0]*0.244,fullapp.size[1]*0.056+i*(NoteBox.spacing+NoteBox.size_of_note[1]))))
                    
                    if(fullapp.notes[i]['state']=='inprogress'):
                        b.add_widget(Label(text='[color=cccccc]Statust: [/color][b][color=adaddf]checking[/color][b]',font_size=fullapp.size[1]*0.03,markup=True,pos=(fullapp.size[0]*0.184,-fullapp.size[1]*0.046+i*(NoteBox.spacing+NoteBox.size_of_note[1]))))

                    b.add_widget(Label(text='[color=353535]from '+ fullapp.notes[i]['date'],markup=True,font_size=fullapp.size[1]*0.025,pos=(fullapp.size[0]*0.384,-fullapp.size[1]*0.076+i*(NoteBox.spacing+NoteBox.size_of_note[1]))))
            
            NoteBox.add_widget(b)

        DefendWidget = Widget(size=fullapp.size,pos=fullapp.pos,size_hint=(None,None))
        NoteScroll.add_widget(NoteBox)
        DefendWidget.add_widget(NoteScroll)
        DefendWidget.add_widget(Button(size_hint=(None,None),pos=(fullapp.size[0]*0.11,fullapp.size[1]*0.13),size=(25,25),background_normal='47.png',on_press=exit))
        if(len(fullapp.notes)==0):
            DefendWidget.add_widget(Label(text='Non pushers',pos=(self.scrollpos[0]+self.scrollsize[0]/3.6,self.scrollpos[1]+self.scrollsize[1]/2),font_size=fullapp.size[1]*0.04))
        else:
            DefendWidget.add_widget(Label(text_size=(fullapp.size[0]*0.7,100),text='[color=010101]view in [b] http://www.sechenovclinic.ru/[/color][/b]',font_size=fullapp.size[1]*0.02,pos=(self.scrollpos[0]+self.scrollsize[0]/2.7,self.scrollpos[1]-fullapp.size[1]*0.047),markup=True))
        NotePopup.add_widget(DefendWidget)
        self.add_widget(NotePopup)
Beispiel #7
0
    def _update_tabs(self, *l):
        self_content = self.content
        if not self_content:
            return
        # cache variables for faster access
        tab_pos = self.tab_pos
        tab_layout = self._tab_layout
        tab_layout.clear_widgets()
        scrl_v = ScrollView(size_hint=(None, 1))
        tabs = self._tab_strip
        parent = tabs.parent
        if parent:
            parent.remove_widget(tabs)
        scrl_v.add_widget(tabs)
        scrl_v.pos = (0, 0)
        self_update_scrollview = self._update_scrollview

        # update scrlv width when tab width changes depends on tab_pos
        if self._partial_update_scrollview is not None:
            tabs.unbind(width=self._partial_update_scrollview)
        self._partial_update_scrollview = partial(self_update_scrollview,
                                                  scrl_v)
        tabs.bind(width=self._partial_update_scrollview)

        # remove all widgets from the tab_strip
        self.clear_widgets(do_super=True)
        tab_height = self.tab_height

        widget_list = []
        tab_list = []
        pos_letter = tab_pos[0]
        if pos_letter == 'b' or pos_letter == 't':
            # bottom or top positions
            # one col containing the tab_strip and the content
            self.cols = 1
            self.rows = 2
            # tab_layout contains the scrollview containing tabs and two blank
            # dummy widgets for spacing
            tab_layout.rows = 1
            tab_layout.cols = 3
            tab_layout.size_hint = (1, None)
            tab_layout.height = tab_height
            self_update_scrollview(scrl_v)

            if pos_letter == 'b':
                # bottom
                if tab_pos == 'bottom_mid':
                    tab_list = (Widget(), scrl_v, Widget())
                    widget_list = (self_content, tab_layout)
                else:
                    if tab_pos == 'bottom_left':
                        tab_list = (scrl_v, Widget(), Widget())
                    elif tab_pos == 'bottom_right':
                        #add two dummy widgets
                        tab_list = (Widget(), Widget(), scrl_v)
                    widget_list = (self_content, tab_layout)
            else:
                # top
                if tab_pos == 'top_mid':
                    tab_list = (Widget(), scrl_v, Widget())
                elif tab_pos == 'top_left':
                    tab_list = (scrl_v, Widget(), Widget())
                elif tab_pos == 'top_right':
                    tab_list = (Widget(), Widget(), scrl_v)
                widget_list = (tab_layout, self_content)
        elif pos_letter == 'l' or pos_letter == 'r':
            # left ot right positions
            # one row containing the tab_strip and the content
            self.cols = 2
            self.rows = 1
            # tab_layout contains two blank dummy widgets for spacing
            # "vertically" and the scatter containing scrollview
            # containing tabs
            tab_layout.rows = 3
            tab_layout.cols = 1
            tab_layout.size_hint = (None, 1)
            tab_layout.width = tab_height
            scrl_v.height = tab_height
            self_update_scrollview(scrl_v)

            # rotate the scatter for vertical positions
            rotation = 90 if tab_pos[0] == 'l' else -90
            sctr = Scatter(do_translation=False,
                           rotation=rotation,
                           do_rotation=False,
                           do_scale=False,
                           size_hint=(None, None),
                           auto_bring_to_front=False,
                           size=scrl_v.size)
            sctr.add_widget(scrl_v)

            lentab_pos = len(tab_pos)

            # Update scatter's top when it's pos changes.
            # Needed for repositioning scatter to the correct place after its
            # added to the parent. Use clock_schedule_once to ensure top is
            # calculated after the parent's pos on canvas has been calculated.
            # This is needed for when tab_pos changes to correctly position
            # scatter. Without clock.schedule_once the positions would look
            # fine but touch won't translate to the correct position

            if tab_pos[lentab_pos - 4:] == '_top':
                #on positions 'left_top' and 'right_top'
                sctr.bind(pos=partial(self._update_top, sctr, 'top', None))
                tab_list = (sctr, )
            elif tab_pos[lentab_pos - 4:] == '_mid':
                #calculate top of scatter
                sctr.bind(
                    pos=partial(self._update_top, sctr, 'mid', scrl_v.width))
                tab_list = (Widget(), sctr, Widget())
            elif tab_pos[lentab_pos - 7:] == '_bottom':
                tab_list = (Widget(), Widget(), sctr)

            if pos_letter == 'l':
                widget_list = (tab_layout, self_content)
            else:
                widget_list = (self_content, tab_layout)

        # add widgets to tab_layout
        add = tab_layout.add_widget
        for widg in tab_list:
            add(widg)

        # add widgets to self
        add = self.add_widget
        for widg in widget_list:
            add(widg)