Esempio n. 1
0
    def on_enter(self):

        carousel = Carousel(direction='right')

        # tłumaczenie słowa-połaczenie z layoutem
        for litera in self.lang["translate"]:
            litera_tlumaczenie = self.lang["translate"][litera]["translation"]
            layout = builder.Builder.load_file("learn_layout.kv")
            carousel.add_widget(layout)

            slowo = layout.ids.slowo
            slowo.text = self.lang["translate"][litera]["word"]

            duza_litera = layout.ids.duza_litera
            duza_litera.text = litera

            # Podpięte działania
            layout.ids.zamien_litere.bind(
                on_release=action(duza_litera, litera, litera_tlumaczenie)
            )

            # utrzymanie przycisku
            polub = layout.ids.fav
            przycisk_ulubione(polub, litera, self.ulubione)

            # Dźwięk
            litera_sound = self.lang["translate"][litera]["sound"]
            layout.ids.play_sound.bind(on_release=play_sound(litera_sound))

        self.add_widget(carousel)
Esempio n. 2
0
    def build(self):

        scroll = ScrollView()
        grid = GridLayout(cols=1, spacing=1, size_hint_y=None)
        grid.bind(minimum_height=grid.setter('height'))
        scroll.add_widget(grid)
        for r in range(0, 50):
            bt = Button(text='Slow start ' + str(r),
                        size_hint_y=None,
                        height=cm(2))
            grid.add_widget(bt)
        scroll2 = ScrollView()
        grid2 = GridLayout(cols=1, spacing=1, size_hint_y=None)
        grid2.bind(minimum_height=grid2.setter('height'))
        scroll2.add_widget(grid2)
        for r in range(50, 100):
            bt = Button(text="Fast scrolling doesn't work " + str(r),
                        size_hint_y=None,
                        height=cm(2))
            grid2.add_widget(bt)

        carousel = Carousel()
        carousel.add_widget(scroll)
        carousel.add_widget(scroll2)
        return carousel
Esempio n. 3
0
    def CarouselMaker(self, category: str, subcategory: str):
        conn = sqlite3.connect('Information.db')
        curs = conn.cursor()
        curs.execute("SELECT * FROM Information WHERE Category = \"" +
                     category + "\" AND Subcategory = \"" + subcategory + "\"")
        listofall = curs.fetchall()
        conn.close()

        caros = Carousel(direction="right")
        for i in listofall:
            imagesrc = i[3].replace('\\', "/")
            sampbis = i[4]
            sampeng = i[5]
            container = RelativeLayout(size_hint=(.8, .8),
                                       pos_hint={
                                           'center_x': .5,
                                           'center_y': .5
                                       })
            image = Image(source=imagesrc)
            sentenceBtn = sentenceButton(sampeng, sampbis)

            container.add_widget(image)
            container.add_widget(sentenceBtn)
            caros.add_widget(container)

        quiz_portal = QuizPortal()
        quiz_portal.btn.bind(on_release=self.on_quiz_btn_pressed)
        caros.add_widget(quiz_portal)
        return caros
Esempio n. 4
0
 def __init__(self, **kwargs):
     Screen.__init__(self, **kwargs)
     main = BoxLayout(orientation="vertical")
     main.add_widget(ActionBar(size_hint=(1, .125)))
     carousel = Carousel(direction='right')
     layout = GridLayout(rows=2)
     i, c = 0, 0
     for card in self.definition.cards(App.get_running_app().achievements,
                                       use_blocks=False):
         color = (1, 1, 1, 1)
         if str(card) in self.definition.blocked_cards:
             color = (.5, 0, 0, 1)
         layout.add_widget(CardSelect(card=card,
                                      color=color,
                                      callback=self._card_detail,
                                      args=(card,)))
         i += 1
         c += 1
         if i == 10:
             carousel.add_widget(layout)
             layout = GridLayout(rows=2)
             i = 0
     if c < 50 + len(self.definition.specials):
         layout.add_widget(CardSelect(card=self.LOCKED_CARD))
     carousel.add_widget(layout)
     main.add_widget(carousel)
     self.add_widget(main)
Esempio n. 5
0
    def build(self):
        carousel = Carousel(direction='right')
        src = "https://static2.abc.es/media/tecnologia/2019/08/01/[email protected]"
        image = AsyncImage(source=src, allow_stretch=True)
        carousel.add_widget(image)

        return carousel
	def __init__(self, **kwargs):
		super(screenLayout, self).__init__(**kwargs)

		#buttons
		larrow = Button(background_normal='arrows/scroll-left.png',
				background_down='arrows/scroll-left-hit.png',
				size_hint = (0.06,0.1),
				pos_hint={'x':0, 'y':.5},
				)
		rarrow = Button(background_normal='arrows/scroll-right.png',
				background_down='arrows/scroll-right-hit.png',
				size_hint = (0.06,0.1),
				pos_hint={'x':0.93, 'y':.5}						
				)
		

		#carousel gallery
		root = Carousel(loop='true')
		for i in range(1,5):
			src = "images/%d.png" % i
			images = Image(source=src, 
				   pos_hint = {'x':0.15,'y':0.25},
				   size_hint= (0.7,0.7),
				   allow_stretch=True)
			root.add_widget(images)	

		self.add_widget(root)
		self.add_widget(larrow)
		self.add_widget(rarrow)
Esempio n. 7
0
class CarouCntrl(Widget):
    # root
    def __init__(self):
        super(CarouCntrl, self).__init__()

        # init screens
        self.home_screen = HomeScreen(name='home')
        self.settings_screen = SettingsScreen(name='settings')
        # self.draw_screen = DrawScreen(name='draw')

        # init carousel
        self.carousel = Carousel(direction='right', loop=True)

        # add widgets to carousel
        # for i in range(3):
        #     self.carousel.add_widget(self.home_screen)

        self.carousel.add_widget(self.home_screen)
        self.carousel.add_widget(self.settings_screen)
        # self.carousel.add_widget(self.draw_screen)

        # start getting data from OWM
        self.owm_link = OWMLink(self)
        self.owm_thread = threading.Thread(target=self.owm_link.run, args=())
        self.owm_thread.start()

    def shutdown(self):
        self.owm_link.keep_running = False
Esempio n. 8
0
class DeckCatalogScreen(Screen):

    """Provide a means of exploring and purchasing available decks."""

    catalog = ObjectProperty()

    def __init__(self, **kwargs):
        Screen.__init__(self, **kwargs)
        self.carousel = Carousel(direction="right")
        standard = self.catalog["Lovers & Spies Deck"]
        self.carousel.add_widget(DeckDisplay(deck=standard, purchased=True))
        for deck in self.catalog:
            if deck == standard: continue
            purchased = self.catalog.purchased(deck) is not None
            self.carousel.add_widget(DeckDisplay(deck=deck, purchased=purchased))
                                     
        main = BoxLayout(orientation="vertical")
        main.add_widget(ActionBar())
        main.add_widget(self.carousel)
        self.add_widget(main)

    def update(self):
        for slide in self.carousel.slides:
            if slide.deck.base_filename == "Standard":
                continue
            slide.purchased = self.catalog.purchased(slide.deck) is not None
Esempio n. 9
0
class CarouselApp(App):
    def myChange(self, instance, value):
        print(self.carousel.index)
        pass

    def build(self):
        global page
        self.count = 0

        self.carousel = Carousel(direction='right')
        self.carousel.bind(on_touch_move=self.myChange)
        self.carousel.scroll_distance = 1
        self.carousel.scroll_timeout = 999
        #self.carousel.

        box = BoxLayout(orientation='vertical', padding=3)
        self.text = Label(text=page[self.count],
                          pos=(10, 0),
                          width=300,
                          height=100)
        for i in range(10):
            source = f'{i}.jpg'
            self.image = Image(source=source)
            self.carousel.add_widget(self.image)
        self.slide = self.carousel.next_slide
        box.add_widget(self.carousel)
        box.add_widget(self.text)
        return box
Esempio n. 10
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.orientation = 'vertical'
        self.add_widget(nav())

        Box1 = BoxLayout(orientation='vertical', padding=[10, -125, 10, 35])
        Box1.add_widget(
            Label(text="HealthCare (For Doctors)", font_size='30sp'))

        Box2 = BoxLayout(padding=[50, -175, 50, 35])
        carousel = Carousel(direction='right')

        for i in range(1, 5):
            src = "res/%s.jpg" % str(i)
            image = AsyncImage(source=src, allow_stretch=False)
            carousel.add_widget(image)
        carousel.loop = True
        Clock.schedule_interval(carousel.load_next, 2)
        Box2.add_widget(carousel)

        Grid2 = GridLayout(cols=2,
                           size_hint=(1.0, 0.1),
                           padding=[50, -20, 50, 20],
                           spacing=20,
                           row_default_height=30,
                           row_force_default=True)
        Login = Button(text='Login', on_press=self.Login_Callback)
        Signup = Button(text='SignUp', on_press=self.Signup_Callback)
        Grid2.add_widget(Login)
        Grid2.add_widget(Signup)

        self.add_widget(Box1)
        self.add_widget(Box2)
        self.add_widget(Grid2)
Esempio n. 11
0
 def build(self):
     carousel = Carousel(direction='right')
     for i in range(10):
         src = "http://placehold.it/480x270.png&text=slide-%d&.png" % i
         image = AsyncImage(source=src, allow_stretch=True)
         carousel.add_widget(image)
     return carousel
Esempio n. 12
0
File: main.py Progetto: shrootz/Kivy
 def build(self):
     carousel = Carousel(direction='right')
     for i in range(10):
         src = "http://placehold.it/480x270.png&text=slide-%d&.png" % i
         image = AsyncImage(source=src, allow_stretch=True)
         carousel.add_widget(image)
     return carousel
Esempio n. 13
0
 def __init__(self, **kwargs):
     super(MyW, self).__init__(**kwargs)
     carousel = Carousel(direction='right')
     for i in range(3):
         src = "f%d.png" % i
         image = Factory.AsyncImage(source=src, allow_stretch=True)
         carousel.add_widget(image)
     self.add_widget(carousel)
Esempio n. 14
0
    def build(self):
        carousel = Carousel(direction="right", loop="true")

        for i in range(1, 5):
            src = "images/%d.jpg" % i
            image = Image(source=src, pos=(400, 100), size=(400, 400))
            carousel.add_widget(image)
        return carousel
Esempio n. 15
0
    def build(self):
        carousel = Carousel(direction='bottom')

        for dato in datos:
            # print(dato['miniaturas'])
            image = AsyncImage(source=dato['miniaturas'], allow_stretch=True)
            carousel.add_widget(image)

        return carousel
Esempio n. 16
0
    def build(self):

        carousel = Carousel(direction='right')

        for item in listOfModels:

            carousel.add_widget(item)

        return carousel
Esempio n. 17
0
 def build(self):
     #define the carousel
     carousel = Carousel(direction='right',loop='true')
     filenames = [filename for filename in os.listdir('.') if filename.endswith('.jpg') or filename.endswith('.jpeg')]
     for imagefile in filenames:
         #load pictures from images folder
         imgsize = PILImage.open(imagefile).size
         image = Image(source=imagefile,pos=(0,0), size=imgsize)
         carousel.add_widget(image)
     return carousel
Esempio n. 18
0
def test_previous_and_next(n_slides, index, loop, index_of_previous_slide,
                           index_of_next_slide):
    from kivy.uix.carousel import Carousel
    from kivy.uix.widget import Widget
    c = Carousel(loop=loop)
    for i in range(n_slides):
        c.add_widget(Widget())
    c.index = index
    p_slide = c.previous_slide
    assert (p_slide and c.slides.index(p_slide)) == index_of_previous_slide
    n_slide = c.next_slide
    assert (n_slide and c.slides.index(n_slide)) == index_of_next_slide
Esempio n. 19
0
    def __init__(self, **kwargs):
        kwargs['orientation'] = 'vertical'
        super(GraphView, self).__init__(**kwargs)
        self.graph_list = [CostPlot(),
                           VolumePlot(),
                           DistancePlot(),
                           EfficiencyPlot()]

        graph_carousel = Carousel(direction='right')
        for i in range(len(self.graph_list)):
            graph_carousel.add_widget(self.graph_list[i].graph)
        
        self.add_widget(graph_carousel)
Esempio n. 20
0
 def _show_carousel(self, log_file):
     local_recon = '/home/pi/recon'
     prefix = log_file.split('.', 1)[0]
     carousel = Carousel(direction='right')
     for filename in os.listdir(local_recon):
         if filename.startswith(prefix) and filename.endswith('.png'):
             src = os.path.join(local_recon, filename)
             image = Image(source=src, allow_stretch=True,  size=(620, 460))
             carousel.add_widget(image)
     popup = Popup(title='Reconstruction Results',
                   content=carousel,
                   size_hint=(None, None), size=(640, 480))
     popup.open()
Esempio n. 21
0
 def build(self):   
   
     root = self.root
     
     # get any files into images directory
     curdir = dirname(__file__)
  
     carousel = Carousel(direction='right', loop='True')
     #replace file_name with the directory where your pictures are located
     for filename in glob(join(curdir, 'file_name', '*')):
         image = Factory.AsyncImage(source=filename, allow_stretch=True)
         carousel.add_widget(image)
     return carousel
Esempio n. 22
0
    def build(self):
        carousel = Carousel(
            direction='right',
            loop=True,
        )
        for i in range(2):

            src0 = 'images/city.gif'
            src1 = 'images/clouds.gif'
            src2 = 'images/Eve_Online_Battle_01.jpg'
            image = AsyncImage(source=src2)
            carousel.add_widget(image)
        return carousel
Esempio n. 23
0
 def build(self):
     Window.size = (480, 800)
     Window.fullscreen = False
     layout = BoxLayout(orientation='vertical')
     carousel = Carousel(direction='right')
     layout.add_widget(carousel)
     b = BackButton(text='Back ', size_hint=(None, None), size=(100, 50))
     layout.add_widget(b)
     # get any files into images directory
     curdir = dirname(__file__)
     for filename in glob(join(curdir, 'DCIM', '*')):
         image = AsyncImage(source=filename, allow_stretch=True)
         carousel.add_widget(image)
     return layout
Esempio n. 24
0
 def build(self):
     carousel = Carousel(direction="right")
     for i in range(10):
         layout = BoxLayout(orientation="vertical")
         image1 = AsyncImage(source=("http://placehold.it/480x270.png&text=slide-%d&.png" % i), allow_stretch=True)
         image2 = AsyncImage(
             source=("http://placehold.it/480x270.png&text=slide-%d&.png" % (i + 1)), allow_stretch=True
         )
         layout.add_widget(image1)
         layout.add_widget(Label(text="Image %d" % i, font_size=30))
         layout.add_widget(image2)
         layout.add_widget(Label(text="Second Image %d" % (i + 1), font_size=30))
         carousel.add_widget(layout)
     return carousel
    def build(self):

        # Add carousel
        # And add the direction of swipe
        carousel = Carousel(direction='right')

        # Adding 10 slides
        for i in range(caroSize):
            src = "c:/users/' + UNAME + '/Pictures/caro/%d.png" % i
            # using Asynchronous image
            image = AsyncImage(source=src, allow_stretch=True)
            carousel.add_widget(image)
        Clock.schedule_interval(carousel.load_next, Timing)
        return carousel
Esempio n. 26
0
 def btn_stats_state(self, instance, value):
     print "btn2", instance, value
     if value == 'down':
         gg = self.ayevent.get_all_stats_graph()
         carousel = Carousel(direction='right',  loop=True)
         for g in gg:
             print g
             image = Factory.AsyncImage(source=g, allow_stretch=True)
             carousel.add_widget(image)            
         self._stats_removed = self.mainw.children[0]
         self.mainw.remove_widget(self._stats_removed)
         self.mainw.add_widget(carousel, 0)
     elif value == 'normal':
         self.mainw.remove_widget(self.mainw.children[0])
         self.mainw.add_widget(self._stats_removed)
Esempio n. 27
0
    def __init__(self, **kwargs):
        super(ArticleCarouselContainer, self).__init__(**kwargs)
        c = Carousel(direction="right")
        for src in active_sources:
            c.add_widget(ScrollContainer(src=src))
        f = BoxLayout(size_hint=(1, 0.1))
        b1 = Button(text='previous source')
        f.add_widget(b1)
        b2 = Button(text='next source')
        f.add_widget(b2)
        self.add_widget(f)
        self.add_widget(c)

        b1.bind(on_press=lambda x: c.load_previous())
        b2.bind(on_press=lambda x: c.load_next())
Esempio n. 28
0
    def build(self):
        labels=App.get_running_app().labels
        layout=BoxLayout(orientation='vertical')
        carouselDisplay=CarouselDisplay(height=500, width=500)
        carousel = Carousel(direction='right', loop=True)
        for coin in coins:
            labels[coin]=Factory.Label(text=coin + ' ' + App.get_running_app().stocks.toString(coin))
            carousel.add_widget(labels[coin])

        Clock.schedule_interval(carousel.load_next, 3)

        layout.add_widget(carousel)
        layout.add_widget(carouselDisplay)

        return layout
Esempio n. 29
0
 def build(self):
     global katy
     katy=self.config.get('ustawienia', 'miarakatowa')
     root = Carousel(direction = 'right', loop=False, anim_move_duration=0.4)
     #self.settings_cls = SettingsWithSidebar
     kar = ObjectProperty()
     kar= MenuRoot()
     kar1=Biegun()
     kar2=AzymutDlugosc()
     kar3=PolePowierzchni()
     kar4=WciecieLiniowe()
     karTab=[kar,kar1,kar2,kar3,kar4]
     for x in range(5):
         klas=karTab[x]
         root.add_widget(klas)
     return root_widget
Esempio n. 30
0
    def __init__(self, **kwargs):
        super(Photo, self).__init__(**kwargs)

        self.bl = BoxLayout(orientation="vertical")

        carousel = Carousel(loop=True)
        for i in range(3):
            src = "img/f%d.jpg" % i
            image = Factory.AsyncImage(source=src, allow_stretch=True)
            carousel.add_widget(image)
        self.btn = Button(text="Back to menu",
                          on_press=lambda x: set_screen('menu'),
                          size_hint=(1, 0.1))
        self.bl.add_widget(carousel)
        self.bl.add_widget(self.btn)
        self.add_widget(self.bl)
Esempio n. 31
0
def test_remove_widget(loop):
    from kivy.uix.carousel import Carousel
    from kivy.uix.widget import Widget

    c = Carousel(loop=loop)
    assert c.index is None
    assert c.current_slide is None
    assert len(c.children) == 0
    assert len(c.slides) == 0

    N_SLIDES = 4
    for i in range(N_SLIDES):
        c.add_widget(Widget())
    assert c.index == 0
    assert c.current_slide == c.slides[0]
    assert len(c.children) == 3 if loop else 2
    assert len(c.slides) == N_SLIDES

    # test issue #6370
    c.index = len(c.slides) - 1
    c.remove_widget(c.slides[0])

    # remove a slide(smaller index than the current_slide's).
    c.index = 1
    old_current_slide = c.current_slide
    c.remove_widget(c.slides[c.index - 1])
    assert c.index == 0
    assert c.current_slide is old_current_slide
    assert len(c.children) == 2
    assert len(c.slides) == 2

    # remove a slide(bigger index than the current_slide's).
    old_current_slide = c.current_slide
    c.remove_widget(c.slides[c.index + 1])
    assert c.index == 0
    assert c.current_slide is old_current_slide
    assert len(c.children) == 1
    assert len(c.slides) == 1

    # remove the current_slide(the last one left).
    c.remove_widget(c.current_slide)
    assert c.index is None
    assert c.current_slide is None
    assert len(c.children) == 0
    assert len(c.slides) == 0
Esempio n. 32
0
class Example1(App):

    def build(self):

        self.additional_init()

        self.carousel = Carousel(
            direction='right', 
            loop=True)

        for src in k.filenames:
            image = Factory.AsyncImage(source=src, allow_stretch=True)
            self.carousel.add_widget(image)
        return self.carousel

    def additional_init(self):
        self._keyboard = Window.request_keyboard(self._keyboard_closed, self, 'text')
        self._keyboard.bind(on_key_down=self._on_keyboard_down)

    def _keyboard_closed(self):
        print('My keyboard have been closed!')
        self._keyboard.unbind(on_key_down=self._on_keyboard_down)
        self._keyboard = None

    def _print_debug(self, keycode, text, modifiers):
        print('The key', keycode, 'have been pressed')
        print(' - text is %r' % text)
        print(' - modifiers are %r' % modifiers)

    def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
        self._print_debug(keycode, text, modifiers)

        # If we hit escape, release the keyboard
        k = keycode[1]
        if k == 'escape':
            keyboard.release()

        if k == 'right':
            self.carousel.load_next()
            pass
        if k == 'left':
            self.carousel.load_previous()
            pass

        return True
Esempio n. 33
0
    def build(self):
        # define the carousel
        carousel = Carousel(direction="right")
        carousel.anim_move_duration = 1
        carousel.padding = 40
        carousel.loop = True
        image1 = Image(source="nature1.jpg")
        carousel.add_widget(image1)
        image2 = Image(source="nature2.jpg")
        carousel.add_widget(image2)
        image3 = Image(source="nature3.jpg")
        carousel.add_widget(image3)
        image4 = Image(source="nature4.jpg")
        carousel.add_widget(image4)
        eticheta = Label(text="Am ajuns la finalul listei!", font_size=40)
        carousel.add_widget(eticheta)

        return carousel
Esempio n. 34
0
 def build(self):
     #define the carousel
     carousel = Carousel(direction='right')
     carousel.anim_move_duration = 1
     carousel.padding = 40
     carousel.loop = True
     image1 = Image(source="nature1.jpg")
     carousel.add_widget(image1)
     image2 = Image(source="nature2.jpg")
     carousel.add_widget(image2)
     image3 = Image(source="nature3.jpg")
     carousel.add_widget(image3)
     image4 = Image(source="nature4.jpg")
     carousel.add_widget(image4)
     eticheta =  Label (text = "Am ajuns la finalul listei!", font_size = 40)
     carousel.add_widget(eticheta)
     
     return carousel
Esempio n. 35
0
    def build(self):
        carousel = Carousel(direction='right')
        lang = load_lang("lang/rus/config.py")
        ulubione = pickle.load(open("ulubione.p", "rb"))
        #ulubione = []
        # lang = {"translate":  {'а': {'translation': 'a', 'word': 'мама'}, 'б': {'translation': 'b', 'word': 'бумага'}}}

        #tło
        with carousel.canvas:
            Color(1, 1, 1)
            Rectangle(source="img/tlo.png", pos=carousel.pos, size=Window.size)
        #tłumaczenie słowa-połaczenie z layoutem
        for litera in lang["translate"]:
            litera_tlumaczenie = lang["translate"][litera]["translation"]
            layout = builder.Builder.load_file("learn_layout.kv")
            carousel.add_widget(layout)
            if 'size' in lang["translate"][litera].keys():
                duza_litera.font_size = lang["translate"][litera]['size']

            slowo = layout.ids.slowo
            duza_litera = layout.ids.duza_litera
            duza_litera = layout.ids[
                'duza_litera']  # komenda równoznaczna z komendą powyżej
            duza_litera.text = litera
            slowo.text = lang["translate"][litera]["word"]

            layout.ids.zamien_litere.bind(
                on_release=action(duza_litera, litera, litera_tlumaczenie))

            #utrzymanie przycisku
            pulub = layout.ids.fav
            pulub.aktywny = False
            if litera in ulubione:
                aktywuj(pulub, True)

            pulub.bind(on_release=dodaj_ulub(ulubione, litera, pulub,
                                             pulub.background_normal,
                                             pulub.background_down))

            litera_sound = lang["translate"][litera]["sound"]

            layout.ids.play_sound.bind(on_release=play_sound(litera_sound))

        return carousel
Esempio n. 36
0
class ImgCarousel(AnchorLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # padding: [padding_left, padding_top, padding_right, padding_bottom]
        self.padding=("0dp", "50dp", "0dp", "10dp")
        self.carousel = Carousel(direction='right')
        #self.carousel.pos_hint = {"top":.9}
        for i in range(10):
            src = "https://i.imgur.com/x7WdmHBb.jpg"
            image = AsyncImage(source=src, allow_stretch=True)
            self.inner_carousel_layout = MDRelativeLayout()
            self.prev_btn = MDIconButton(icon="menu-left", user_font_size ="200sp", on_release = lambda x:self.carousel.load_previous(), pos_hint={"center_x":.1, "center_y":.5}) # pos_hint={"left":.2, "y":.5},
            self.next_btn = MDIconButton(icon="menu-right", user_font_size ="200sp", on_release = lambda x:self.carousel.load_next(), pos_hint={"center_x":.9, "center_y":.5}) # pos_hint={"right":.8, "y":.5}

            self.inner_carousel_layout.add_widget(image)
            self.inner_carousel_layout.add_widget(self.prev_btn)
            self.inner_carousel_layout.add_widget(self.next_btn)
            self.carousel.add_widget(self.inner_carousel_layout)
        self.add_widget(self.carousel)
Esempio n. 37
0
    def on_enter(self):
        carousel = Carousel(direction='right')

        wszystkie_litery_alf = list(self.lang["translate"].keys())

        random.shuffle(wszystkie_litery_alf)

        for litera in wszystkie_litery_alf:
            litera_sound = self.lang["translate"][litera]["sound"]
            if litera_sound is None: continue
            litera_tlumaczenie = self.lang["translate"][litera]["translation"]
            layout = builder.Builder.load_file("fon_quiz_layout.kv")
            carousel.add_widget(layout)

            odp_false=(1,0.2,0,0.8)
            odp_true = (0, 1, 0, 0.8)

            odp_A=layout.ids.odp_A
            odp_B = layout.ids.odp_B
            odp_C = layout.ids.odp_C
            odp_D = layout.ids.odp_D

            buttons=[odp_A,odp_B,odp_C,odp_D]

            wszystkie_litery = list(self.lang["translate"].keys())
            wszystkie_litery.remove(litera)
            wybrane_litery=random.sample(wszystkie_litery, 3)
            wybrane_litery.append(litera)

            random.shuffle(wybrane_litery)
            layout.score = str(NumericProperty(0))
            layout.ids.wynik=layout.score
            for Przycisk, wybrana_litera in zip(buttons, wybrane_litery):
                Przycisk.text = wybrana_litera
                if litera == wybrana_litera:
                    Przycisk.bind(on_release=action(self, Przycisk, odp_true, buttons, layout, True))
                else:
                    Przycisk.bind(on_release=action(self, Przycisk, odp_false, buttons, layout, False))

            layout.ids.play_sound.bind(on_release= play_sound(litera_sound))

        self.add_widget(carousel)
Esempio n. 38
0
class Columns(GridLayout):
    def __init__(self, text, **kwargs):
        super(Columns, self).__init__(size_hint_x=1, rows=2)
        self.current_block = 0
        self.carousel = Carousel(direction='right',
                                 size_hint_x=1,
                                 size_hint_y=1)
        self.carousel.bind(index=self.update_title)

        self.title_label = Label(font_name=FONT,
                                 markup=True,
                                 font_size=30,
                                 size_hint_y=0.1)

        self.update_content(text)

    def update_title(self, *kwargs):
        if len(kwargs) > 0:
            self.current_block = kwargs[1] or 0
        title = emphasize_part(self.word.string, idx=self.current_block)
        etymology_str = (' ({})'.format(
            emphasize_part(self.word.etymology, idx=self.current_block))
                         if self.word.etymology else '')
        title += etymology_str
        self.title_label.text = title

    def analyze(self, text):
        self.word = Word(text, compute_etymology=True)
        self.blocks = self.word.get_blocks_for_selected_meaning()

    def update_content(self, text):
        self.clear_widgets()
        self.carousel.clear_widgets()
        self.analyze(text)
        self.update_title()

        for block in self.blocks:
            words = DbUtil().get_words_with_block(block, exclude=self.word)
            self.carousel.add_widget(BlockColumn(block, words))

        self.add_widget(self.title_label)
        self.add_widget(self.carousel)
    def build(self):
        """Return the Kivy carousel of gallery images when the app is run."""

        try:
            exhibit.show_gallery()
        except exhibit.GalleryError:
            print "Number of input images is not equal to number of effects."
            return

        output_dir = "output-images"
        input_dir = "source-images"

        carousel = Carousel(direction="right")
        source = ["alf.png", "hug.png", "sad.jpg", "jegermeister.jpg"]
        for filename in source:
            original_image = AsyncImage(source=(os.path.join(input_dir, filename)), allow_stretch=True)
            carousel.add_widget(original_image)
            new_image = AsyncImage(source=(os.path.join(output_dir, filename)), allow_stretch=True)
            carousel.add_widget(new_image)
        return carousel
Esempio n. 40
0
class ViewSpellScreen(MyScreen):
    def __init__(self, **kwargs):
        super(ViewSpellScreen, self).__init__(**kwargs)

        self.carousel = Carousel()
        self.content_box.add_widget(self.carousel)

        self.bind(on_pre_enter= self.prepare_yourself)
    
    def prepare_yourself(self,i=0):
        self.carousel.clear_widgets()

        

        for spell in App.get_running_app().root.current_list:
            
            self.carousel.add_widget(spell['view_spell_card'])

        position = App.get_running_app().root.current_position

        self.carousel.index = position 
Esempio n. 41
0
    def build(self):
        
        scroll = ScrollView()
        grid = GridLayout(cols=1, spacing=1, size_hint_y=None)
        grid.bind(minimum_height=grid.setter('height'))
        scroll.add_widget(grid)
        for r in range(0,50):
            bt = Button(text='Slow start '+str(r), size_hint_y=None, height=cm(2))
            grid.add_widget(bt)
        scroll2 = ScrollView()
        grid2 = GridLayout(cols=1, spacing=1, size_hint_y=None)
        grid2.bind(minimum_height=grid2.setter('height'))
        scroll2.add_widget(grid2)
        for r in range(50,100):
            bt = Button(text="Fast scrolling doesn't work "+str(r), size_hint_y=None, height=cm(2))
            grid2.add_widget(bt)

            
        carousel = Carousel()
        carousel.add_widget(scroll)
        carousel.add_widget(scroll2)
        return carousel
    def build(self):
        """Return the Kivy carousel of gallery images when the app is run."""

        try:
            exhibit.show_gallery()
        except exhibit.GalleryError:
            print "Number of input images is not equal to number of effects."
            return

        output_dir = "output-images"
        input_dir = "source-images"

        carousel = Carousel(direction='right')
        source = ["alf.png", "hug.png", "sad.jpg", "jegermeister.jpg"]
        for filename in source:
            original_image = AsyncImage(source=(os.path.join(
                input_dir, filename)),
                                        allow_stretch=True)
            carousel.add_widget(original_image)
            new_image = AsyncImage(source=(os.path.join(output_dir, filename)),
                                   allow_stretch=True)
            carousel.add_widget(new_image)
        return carousel
Esempio n. 43
0
    def build(self):
        root = Carousel()
        page1 = GridLayout(cols=2, rows = 3, padding = 10, spacing=10)

        btn1 = GPButton(24,11,text='Pump 2',size=(75,50),size_hint=(.5,.25))
        btn2 = GPButton(18,23,text='Pump 1')
        btn3 = GPButton(19,26,text='Pump 4')
        btn4 = GPButton(6,13,text='Pump 3')
        btn5 = GPButton(27,22,text='Pump 6')
        btn6 = GPButton(4,17,text='Pump 5')

        page1.add_widget(btn2)
        page1.add_widget(btn1)
        page1.add_widget(btn4)
        page1.add_widget(btn3)
        page1.add_widget(btn6)
        page1.add_widget(btn5)

        page2 = AnchorLayout()
        img = Image(source='..\\res\\img\\coke.png')
        page2.add_widget(img)

        page3 = AnchorLayout()
        img = Image(source='..\\res\\img\\martini.png')
        page3.add_widget(img)

        page4 = AnchorLayout()
        img = Image(source='..\\res\\img\\dik.png')
        page4.add_widget(img)
        
        # add pages to carousel
        root.add_widget(page1)
        root.add_widget(page2)
        root.add_widget(page3)
        root.add_widget(page4)
        
        return root
Esempio n. 44
0
class MainScreen(BoxLayout):

    def __init__(self, **kwargs):
        super(MainScreen, self).__init__(**kwargs)
        self.orientation = 'vertical'
        title = TitleBar()

        self.carousel = Carousel(direction='right', loop=False)
        self.spacing=10

        dico = Dictionary()
        self.carousel.add_widget(dico)

        self.m = MainMenu()
        self.m.convert_button.bind(on_release=self.convert)
        self.m.dictionary_button.bind(on_release=self.dictionary)
        self.carousel.add_widget(self.m)
        self.carousel.load_slide(self.m)

        self.textEntry = TextEntry()
        self.textEntry.paragraph_button.bind(on_press=self.convert_paragraph)
        self.carousel.add_widget(self.textEntry)

        self.result = ResultEntry()
        self.result.back.bind(on_press=self.back)
        self.carousel.add_widget(self.result)

        self.add_widget(title)
        self.add_widget(self.carousel)


    def convert(self, object):
        self.carousel.load_next()

    def dictionary(self, object):
        self.carousel.load_previous()

    def back(self, object):
        self.carousel.load_slide(self.m)

    def convert_paragraph(self, object):
        old_text = self.textEntry.paragraph.text
        new_text = politically_correct.polit_changer(old_text)
        self.result.paragraph.text = new_text
        self.carousel.load_next()
Esempio n. 45
0
    def build(self):
        carousel = Carousel(direction='right')

        src = "https://farm8.staticflickr.com/7404/10772400223_244bb727c6_z_d.jpg"
        image = AsyncImage(source=src, allow_stretch=True)
        carousel.add_widget(image)

        src = "https://farm6.staticflickr.com/5139/5519598097_e91d45b195_z_d.jpg"
        image = AsyncImage(source=src, allow_stretch=True)
        carousel.add_widget(image)

        src = "https://farm3.staticflickr.com/2920/33021716475_4fffb8f11a_z_d.jpg"
        image = AsyncImage(source=src, allow_stretch=True)
        carousel.add_widget(image)

        src = "https://farm1.staticflickr.com/271/20147143552_28affd24e7_z_d.jpg"
        image = AsyncImage(source=src, allow_stretch=True)
        carousel.add_widget(image)

        return carousel
Esempio n. 46
0
    def build(self):
        carousel = Carousel(direction='right', loop = True, size_hint=(1,1))
        src1 = "images/mock-up.png"
        image1 = AsyncImage(source=src1, allow_stretch=True)
        ana1 = Analyzer(title='Top1: 22 times', content='You missed the morning class ;(', chart=src1)

        carousel.add_widget(ana1)

        ana2 = Analyzer(title='Top2: 10 times', content='You forgot to call papaw ;/', chart=src1)
        carousel.add_widget(ana2)

        ana3 = Analyzer(title='Top3: 3 times', content='You spent too much money on games ;0', chart=src1)
        carousel.add_widget(ana3)

        return carousel
    def build(self):

        MainAppWindow = AppBody(orientation='vertical')
        ToolBar = Bubble(size_hint=[1, .1])
        MainAppWindow.add_widget(ToolBar)
        WorkArea = AnchorLayout()
        MainAppWindow.add_widget(WorkArea)

        self.Timer_icon = Timer_icon = HeaderLables(size_hint=[1 / 5, 1])
        Timer_icon.img1.source = 'icons8-alarm-clock-96.png'
        Timer_icon.btn1.bind(on_release=self.GoTOTimer_widget)

        self.Stopclock_widget = Stopclock_widget = HeaderLables(
            size_hint=[1 / 5, 1])
        Stopclock_widget.img1.source = 'icons8-sport-stopwatch-96.png'
        Stopclock_widget.btn1.bind(on_release=self.GoTOStopclock_widget)

        self.Alarm_widget = Alarm_widget = HeaderLables(size_hint=[1 / 5, 1])
        Alarm_widget.img1.source = 'icons8-alarm-96.png'
        Alarm_widget.btn1.bind(on_release=self.GoTOAlarm_widget)

        self.Cust_widget = Cust_widget = HeaderLables(size_hint=[1 / 5, 1])
        Cust_widget.img1.source = 'icons8-star-96.png'
        Cust_widget.btn1.bind(on_release=self.GoTOCust_widget)

        self.Settings_widget = Settings_widget = HeaderLables(
            size_hint=[1 / 5, 1])
        Settings_widget.img1.source = 'icons8-settings-96.png'
        Settings_widget.btn1.bind(on_release=self.GoTOSettings_widget)

        ToolBar.add_widget(Timer_icon)
        ToolBar.add_widget(Stopclock_widget)
        ToolBar.add_widget(Alarm_widget)
        ToolBar.add_widget(Cust_widget)
        ToolBar.add_widget(Settings_widget)

        self.myTimer = Timer_widget()
        self.myStopClock = StopClockWidget()
        self.myAM = AM_SM()
        carousel = Carousel(direction='right')
        carousel.add_widget(self.myTimer)
        carousel.add_widget(self.myStopClock)
        carousel.add_widget(self.myAM)
        WorkArea.add_widget(carousel)
        return MainAppWindow
Esempio n. 48
0
    def build(self):
        # set the window size
        Window.size = (800, 480)

        # load miscellaneous stuff that's in kv language
        # Builder.load_string(misc)

        # setup the Carousel such that we can swipe between screens
        carousel = Carousel(direction='right')

        # add the homescreen widget to the carousel with the sidebar
        homescreen = Builder.load_string(homescr + sidebar)
        carousel.add_widget(homescreen)

        # add the musicscreen widget to the carousel with the sidebar
        musicscreen = Builder.load_string(musicscr + sidebar)
        carousel.add_widget(musicscreen)
        
        # add the rearview camera screen widget to the carousel with the sidebar
        rearviewscreen = Builder.load_string(rearscr + sidebar)
        carousel.add_widget(rearviewscreen)

        return carousel
Esempio n. 49
0
    def build(self):
        # set the window size
        Window.size = (800, 480)

        # load miscellaneous stuff that's in kv language
        # Builder.load_string(misc)

        # setup the Carousel such that we can swipe between screens
        carousel = Carousel(direction='right')

        # add the homescreen widget to the carousel with the sidebar
        homescreen = Builder.load_string(homescr + sidebar)
        carousel.add_widget(homescreen)

        # add the musicscreen widget to the carousel with the sidebar
        musicscreen = Builder.load_string(musicscr + sidebar)
        carousel.add_widget(musicscreen)

        # add the rearview camera screen widget to the carousel with the sidebar
        rearviewscreen = Builder.load_string(rearscr + sidebar)
        carousel.add_widget(rearviewscreen)

        return carousel
Esempio n. 50
0
class LoginScreen(FloatLayout):
    
    #x = ListProperty([])
    
    #print x
    

    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        #gc.disable()
        self.DropdownObjects = []

        self.add_widget(Label(text= "Wilkommen [color=ff3333] [sub] bei der [/sub][/color][color=3333ff][b] Bonierungs[sup][color=#098125ff]App[/sup][/b][/color]",
                              markup = True, pos_hint={'top': 1.2}, font_size='20sp'))


        self.GridlayoutS1 = GridLayout(cols = 2, size_hint_y = 1/5, pos_hint={'top': 0.6})
        self.add_widget(self.GridlayoutS1)
        self.GridlayoutS1.add_widget(Label(text='User Name')) #, size_hint_x = 0.2, size_hint_y = 0.2))
        self.username = TextInput(multiline=False) #, size_hint_x = 0.2, size_hint_y = 0.2)
        self.username.bind(on_text_validate=self.on_enter)
        self.GridlayoutS1.add_widget(self.username)
        self.GridlayoutS1.add_widget(Label(text='password')) #,size_hint_x = 0.2, size_hint_y = 0.2))
        self.password = TextInput(password=True, multiline=False) #, size_hint_x = 0.2, size_hint_y = 0.2)
        self.GridlayoutS1.add_widget(self.password)
        self.BenutzerListe = {"": ""};

        self.add_widget(Button(text='Einloggen', size_hint_y= 1/5, pos_hint={'top': 0.4}, on_release = self.AbfrageLogin))

        self.LabelLoginanzeiger = Label(size_hint_y= 1/5)
        self.add_widget(self.LabelLoginanzeiger)

    def on_enter(self, instance):
        print('User pressed enter in', instance)
        self.password.focus = True







    def AbfrageLogin(self, widget):
        Username = self.username.text
        Passwort = self.password.text
        if Username in self.BenutzerListe and Passwort == self.BenutzerListe[Username]:
              self.LabelLoginanzeiger.text = 'Login korrekt'
              self.clear_widgets()
              self.HauptProgramm()

        else:
              self.LabelLoginanzeiger.text = 'Login inkorrekt'


    def HauptProgramm(self, *args):
        self.SpinnerButtonZustand = 'Alle'
        App.AuswahlHauptlisteAlt = []
        print 'das ist das Hauptprogramm'
        self.BilderListeVorlaeufer = []
        self.BilderListeVorlaeufer = os.listdir(os.getcwd() + '/pictures')
        self.Pfade = []
        for i in self.BilderListeVorlaeufer:
            Pfad = os.path.join('pictures', i)
            if os.path.isfile(Pfad) == True:
                self.Pfade.append(Pfad)
        self.HauptCarousel = Carousel(scroll_timeout = 100)
        App.Pfade = self.Pfade
        self.add_widget(self.HauptCarousel)
        ####################################################################################################
        ### Erste Seite im HauptCarousel momentan mit den produktbildern
        self.HauptCarousel.FloatLayout = FloatLayout()
        self.HauptCarousel.add_widget(self.HauptCarousel.FloatLayout)
        self.HauptCarousel.FloatLayout.GridLayout = GridLayout(cols=3, pos_hint={'x': 0,'y': 0}, size_hint=[1,0.9])
        self.HauptCarousel.FloatLayout.add_widget(self.HauptCarousel.FloatLayout.GridLayout)
        for i in range(2):
            button = Button(background_normal = self.Pfade[i], background_down= 'bilder_oberflaeche/1361740537_Ball Green_mitHaken.png', mipmap= True)
            self.HauptCarousel.FloatLayout.GridLayout.add_widget(button)
##        self.HauptCarousel.FloatLayout.GridLayout.add_widget(Button(text='test'))
##        self.HauptCarousel.FloatLayout.GridLayout.add_widget(Button(text='test2'))

        #####################################################################################################
        ### 2 Seite im Hauptcarousel mit testbutton zur datei Erstellung
        ### 2 Page in MainCarousel with testbutton for creating /exporting to a file
        self.HauptCarousel2 = BoxLayout(orientation='vertical')
        ###self.HauptCarousel.add_widget(self.HauptCarousel2)
        self.HauptCarousel2.Texteingabe = TextInput(multiline=True)
        self.HauptCarousel2.add_widget(self.HauptCarousel2.Texteingabe)

        self.HauptCarousel2.ButtonSchreiben = Button(text="datei schreiben", on_release = self.datenpickeln)
        self.HauptCarousel2.add_widget(self.HauptCarousel2.ButtonSchreiben)
        #######################################################################
        ### 3 Seite im Hauptcarousel momentan mit Datei Auslesefunktion
        ### 3 Page in MainCarousel atm with functionality to read from file
        self.HauptCarousel3 = BoxLayout(orientation='vertical')
        ###self.HauptCarousel.add_widget(self.HauptCarousel3)
        self.HauptCarousel3.Textausgabe = TextInput(multiline=True, readonly = True)
        self.HauptCarousel3.add_widget(self.HauptCarousel3.Textausgabe)

        self.HauptCarousel3.ButtonLesen = Button(text="datei auslesen", on_release = self.datenentpickeln)
        self.HauptCarousel3.add_widget(self.HauptCarousel3.ButtonLesen)
        #######################################################################
        ### 4 Seite im Hauptcarousel momentan mit Tischmanager
	### 4 Page in Maincarousel atm with some kind of Table Manager
        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(0,0,1,1),(1,1,0,1)]
        self.CustomLayout = CustomLayout()
        self.HauptCarousel.add_widget(self.CustomLayout)
        #self.CustomLayout.TopLabel = Label(text = 'Tisch[sup][color=#098125ff]Organizer[/sup][/b][/color]',  markup = True,
                                            #halign= 'left', valign= 'top', text_size= self.size, pos_hint={'x':0, 'y': 0}, font_size= '30sp')
        self.CustomLayout.TopLabel = Label(text = 'Tisch[sup][color=18ea1d]Organizer[/sup][/b][/color]',  markup = True,  # alte farbe: #098125ff
                                           halign= 'left',  font_size= '30sp')
        #self.CustomLayout.add_widget(self.CustomLayout.TopLabel)
        self.CustomLayout.BoxLayout = BoxLayout (orientation = 'horizontal', size_hint = [1,0.05], pos_hint={'x':0, 'y': 0.95})
        self.CustomLayout.add_widget(self.CustomLayout.BoxLayout)
        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.TopLabel)
        ButtonMenu1 = self.DropdownbuttonCreator()
        
        self.CustomLayout.BoxLayout.Button1 = ButtonMenu1
##        self.CustomLayout.BoxLayout.Button2 = Button(text = 'Tisch+' , on_release = self.tischhinzufuegen)
##        self.CustomLayout.BoxLayout.Button3 = Button(text = 'Spalte+', on_release = self.spaltehinzufuegen)
##        self.CustomLayout.BoxLayout.Button4 = Button(text = 'Zeile+', on_release = self.zeilehinzufuegen)
        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button1)
##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button2)
##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button3)
##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button4)
        self.CustomLayoutGridLayout = GridLayout(cols = 3, rows = 4, padding = [20,20], spacing = [30,30], size_hint = [1,0.95], pos_hint={'x':0, 'y': 0})
        #cGridLayout = StackLayout(orientation = "tb-lr", padding = [20,20], spacing = [30,30], size_hint = [1,0.9], pos_hint={'x':0, 'y': 0})

        self.CustomLayout.add_widget(self.CustomLayoutGridLayout)
        self.Tischliste = []
        
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        
        AnzahlTische = 12
        Zielwidget = self.CustomLayoutGridLayout
        self.tischerstellung(Zielwidget,AnzahlTische, Auswahlliste, BackgroundcolorListe)
       
        self.Box=BoxLayout(oreintation='vertical')
        self.CustomScrollviewProduktOrganizerInstanz = CustomScrollviewProduktOrganizer()      #########
                                             #########
        self.ProduktOrganizerInstanz = ProduktOrganizer()
        self.ProduktOrganizerInstanz.ids.SpinnerProduktOrganizer.bind(text=self.produktorganizerfilter)
        self.Box.add_widget(self.ProduktOrganizerInstanz)
        self.ProduktOrganizerInstanz.ids.custScrlInst.data = App.HauptListeDictonaries
        self.HauptCarousel.add_widget(self.Box)
        #self.HauptCarousel.add_widget(self.ProduktOrganizerInstanz)
        self.ButtonHinzufuegen = self.ProduktOrganizerInstanz.ids.ProduktlisteButtonHinzufuegen
        self.ButtonHinzufuegen.on_release = self.produkthinzufuegen

        self.PopupDateiAuswaehlenInst= PopupDateiAuswaehlenProduktorganizer()
        PopupDateiauswahl = self.PopupDateiAuswaehlenInst.ids.b.ids.a
        self.LadeButton = self.ProduktOrganizerInstanz.ids.LadeButton
        self.LadeButton.on_release = PopupDateiauswahl.open
        self.PopupDateiAuswaehlenInst.ids.b.ids.OkButtonFilechooser.on_release = self.datenentpickeln
        self.PopupDateiAuswaehlenInst.ids.b.ids.LayoutPopup.add_widget(Label
                                                                       (text='[b][color=ff3333]Achtung, nicht gespeicherte Eingaben gehen verloren![/b][/color]',
                                                                        size_hint= (1,0.1),
                                                                        markup = True,
                                                                        font_size = 14))

        self.PopupDateiAuswaehlenSpeichernInst = PopupDateiAuswaehlenProduktorganizer()
        PopupDateiauswahlSpeichern = self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.a
        
        
        self.SpeicherButton = self.ProduktOrganizerInstanz.ids.SpeicherButton
        self.SpeicherButton.on_release = PopupDateiauswahlSpeichern.open
        self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.OkButtonFilechooser.on_release = self.datenpickeln
        
        
        
       
        
        
        

        #print 'tempChildernListe',TempChildrenList
        
        #self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.LayoutPopup.add_widget(TextInput(multiline=False, size_hint= (1,0.15)))
        self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.LayoutPopup.add_widget(Label
                                                                       (text='[b][color=ff3333]Achtung, der Inhalt der Datei wird ueberschrieben![/b][/color]',
                                                                        size_hint= (1,0.1),
                                                                        markup = True,
                                                                        font_size = 14))
        TempChildrenList = []
        for q in self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.LayoutPopup.children:
            TempChildrenList.append(q)
        
        
            
        self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.LayoutPopup.clear_widgets()
        
        FileSaveLabelTextInput = Label(text='Zur Erstellung einer neuen Datei,einen Namen angeben',size_hint= (1,0.15), font_size=16)
        self.FileSaveTextInput = TextInput(multiline=False,size_hint= (1,0.15))

        
        TempChildrenList.sort(reverse=True)

        print "vor dem Einfuegen"
        for index, item in enumerate(TempChildrenList):
                print index, item
        
        TempChildrenList.insert(2, FileSaveLabelTextInput)
        TempChildrenList.insert(3, self.FileSaveTextInput)
        
        for i in TempChildrenList:
            #i.parent = None
            self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.LayoutPopup.add_widget(i)

        print "nach dem Einfuegen und sortieren"
            
        for index, item in enumerate(TempChildrenList):
                print index, item
        
        
        
        #self.LadeButton.bind(on_release = self.datenentpickeln)
        Spinner =self.ProduktOrganizerInstanz.ids.SpinnerProduktOrganizer
        SpinnerText = Spinner.text
        self.LadeButton.bind(on_release = self.produktorganizerfilter)

        #self.ButtonHinzufuegen.on_release = self.inputdata

        #self.Box.add_widget(Button(size_hint= (1,0.1),text='inputdata', on_release=self.inputdata))

                                            

        
        self.PopupInst = PopupBildAuswaehlenProduktorganizer()
        popup = self.PopupInst.ids.a
        self.ProduktOrganizerInstanz.ids.ProduktBildAuswaehlen.on_release = popup.open


        self.PersonalOrganizerInstanz = PersonalOrganizer()
        self.HauptCarousel.add_widget(self.PersonalOrganizerInstanz)

        self.ZeitOrganizerInstanz = ZeitOrganizer()
        self.HauptCarousel.add_widget(self.ZeitOrganizerInstanz)

##    def inputdata(self):
##        print 'inputdadat runs'
##        #self.CustomScrollviewProduktOrganizerInstanz.data = [str(i) for i in range(5)]
##        self.ProduktOrganizerInstanz.ids.custScrlInst.data = [str(i) for i in range(5)]
      
        
   
        
    def produkthinzufuegen(self):
        #App.AuswahlHauptlisteAlt = App.AuswahlHauptliste
        NeuesDict ={}
    
        WertEingabeFeldBezeichnung = self.ProduktOrganizerInstanz.ids.EingabeFeldBezeichnung.text
        WertEingabeFeldPreis = self.ProduktOrganizerInstanz.ids.EingabeFeldPreis.text
##        StatusCheckBoxVerkauf = self.ProduktOrganizerInstanz.ids.CheckBoxVerkauf.active
        WertSpinnerKategorie = str(self.ProduktOrganizerInstanz.ids.SpinnerKategorie.text)
        filechooser = self.PopupInst.ids.filechooser
        DateiAuswahl = (str(filechooser.selection))[((str(filechooser.selection)).find('pictures')):-2]
        #print 'hallo', WertEingabeFeldBezeichnung, WertEingabeFeldPreis,DateiAuswahl,WertSpinnerKategorie
        ID = len(App.HauptListeDictonaries)
        NeuesDict = {'ID': ID,
                     'Bezeichnung':WertEingabeFeldBezeichnung,
                     'Preis':WertEingabeFeldPreis,
                     'Bild':DateiAuswahl,
                     'Kategorie':WertSpinnerKategorie}

        #print 'len(App.HauptListeDictonaries)', (len(App.HauptListeDictonaries))
##        if len(App.HauptListeDictonaries)<1:
##            App.HauptListeDictonaries.append(NeuesDict)
##            print 'Fall 1'
##        else:
        Treffer = False
        for i in range(len(App.HauptListeDictonaries[:])):
            print 'App.HauptListeDictonaries[i][Bezeichnung] ist', App.HauptListeDictonaries[i]['Bezeichnung']
            Bezeichnungdict = str(App.HauptListeDictonaries[i]['Bezeichnung'])
            Bezeichnungneuesdict = str(NeuesDict['Bezeichnung'])
            if Bezeichnungdict  == Bezeichnungneuesdict:
               
                Treffer = True
                break
            else:
                Treffer = False
        if Treffer == True:
            #print 'Dieses Produkt existiert schon'
            ButtonVerstanden = Button(text='Verstanden')
            popup = Popup(title='Dieses Produkt existiert bereits ',
                          size_hint = (0.5, 0.25),
                          content= ButtonVerstanden)
            popup.open()
            ButtonVerstanden.on_release = popup.dismiss
        else:
            App.HauptListeDictonaries.append(NeuesDict)
            
            #self.ProduktOrganizerInstanz.ids.custScrlInst.ids.content2.clear_widgets()
##            print len(App.HauptListeDictonaries)
##            for index, item in enumerate(App.HauptListeDictonaries):
##                print index, item

                


            #self.ProduktOrganizerInstanz.ids.custScrlInst.data = App.HauptListeDictonaries
            #self.ProduktOrganizerInstanz.ids.custScrlInst.data  = App.AuswahlHauptliste
            #AktuelleWidgetsInDerListe = self.ProduktOrganizerInstanz.ids.custScrlInst.ids.content2.children
            #print 'App.AuswahlHauptlisteAlt', App.AuswahlHauptlisteAlt
            #AktuelleWidgetsInDerListe = self.CustomScrollviewProduktOrganizerInstanz.ids.content2.children
            #print AktuelleWidgetsInDerListe
            
            #self.ProduktOrganizerInstanz.ids.custScrlInst.ids.content2.add_widget(Button(text='testmanuellereinfuegung'))
            
            AktuellerSpinnerWert = self.ProduktOrganizerInstanz.ids.SpinnerProduktOrganizer.text
            self.ProduktOrganizerInstanz.ids.custScrlInst.ids.content2.clear_widgets()
            
            App.AuswahlHauptliste = []    
            if AktuellerSpinnerWert == 'Alle':
                #self.CustomScrollviewProduktOrganizerInstanz.ids.content2.clear_widgets()
                print 'haha'
                App.AuswahlHauptliste = []
                for i in App.HauptListeDictonaries:
                    if i not in App.AuswahlHauptlisteAlt:
                        pass
                        
                        App.AuswahlHauptliste = App.HauptListeDictonaries
                        App.AuswahlHauptlisteAlt = []
                
            else:
                if self.SpinnerButtonZustand == 'Alle':
                    App.AuswahlHauptlisteAlt = []
                else:
                    pass
                
                for i in App.HauptListeDictonaries:
                    if i not in App.AuswahlHauptlisteAlt:
                        if i['Kategorie'] == AktuellerSpinnerWert:
                             
                            App.AuswahlHauptliste.append(i)
                        else:
                            continue
                    else:
                        continue

            self.ProduktOrganizerInstanz.ids.custScrlInst.data  = App.AuswahlHauptliste

    def produktorganizerfilter(self,  spinner, text='Alle'):
        spinner =self.ProduktOrganizerInstanz.ids.SpinnerProduktOrganizer
        
        text = spinner.text
        
        self.ProduktOrganizerInstanz.ids.custScrlInst.data = []
        #print 'produktorganizerfilter, App.AuswahlHauptlisteAlt', App.AuswahlHauptlisteAlt
        
        if self.SpinnerButtonZustand == 'Alle':
            App.AuswahlHauptlisteAlt = []
        else:
            App.AuswahlHauptlisteAlt = App.AuswahlHauptliste

        #custScrlInst
        self.ProduktOrganizerInstanz.ids.custScrlInst.ids.content2.clear_widgets()
        #self.CustomScrollviewProduktOrganizerInstanz.ids.content2.clear_widgets()
        App.AuswahlHauptliste=[]
        if text == 'Alle':
            
           App.AuswahlHauptliste = App.HauptListeDictonaries
           self.SpinnerButtonZustand = 'Alle'
           if self.ProduktOrganizerInstanz.ids.custScrlInst.data == App.AuswahlHauptliste:
               self.ProduktOrganizerInstanz.ids.custScrlInst.data = []
           
           
        else:
            self.SpinnerButtonZustand = 'Anders'
            for i in App.HauptListeDictonaries:
                if i not in App.AuswahlHauptlisteAlt: 
                    #print i['Kategorie']
                    if i['Kategorie'] == text:
                        App.AuswahlHauptliste.append(i)
                    else:
                        continue
                else:
                    continue

            
                

        #print 'Auswahl Hauptliste ist nun', App.AuswahlHauptliste
        self.ProduktOrganizerInstanz.ids.custScrlInst.data = App.AuswahlHauptliste

                
                
            

       
                    
   

        
        
        
        




    def DropdownbuttonCreator(self):
        Auswahlliste = ["Tisch +", "Tisch -", "Spalte + ", "Spalte -", "Reihe + ", "Reihe -"]
        BackgroundcolorListe = [(0,1,0,1),(1,0,0,1),(0,1,0,1),(1,0,0,1),(0,1,0,1),(1,0,0,1)]
        Aktionsliste = [self.tischhinzufuegen, self.tischentfernen, self.spaltehinzufuegen, self.spalteentfernen, self.zeilehinzufuegen, self.zeileentfernen]
        DropdownObjekt = CustomDropDown()
        DropdownObjektButton = CustomButton(text = "Menue",
        #DropdownObjektButton = ToggleButton(text="Menue",
                                            size_hint=[1,1],
                                            background_color = (0.8, 0.8, 0.00, 1),
                                            background_normal='bilder_oberflaeche/white2.png',
                                            background_down='bilder_oberflaeche/white3.png')
        #self.CustomLayout.add_widget(DropdownObjektButton)
        DropdownObjektButton.bind(on_release=DropdownObjekt.open)
        self.DropdownObjects.append(DropdownObjekt)
        for x in range(len(Auswahlliste)):

                DropdownUnterbutton = Button(text=Auswahlliste[x], font_size = 15, size_hint_y=None, height=60,
                                             background_color = BackgroundcolorListe[x],
                                             background_normal='bilder_oberflaeche/white2.png',
                                             background_down='bilder_oberflaeche/white3.png',
                                             opacity = 0.8,
                                             on_release = Aktionsliste[x])
                DropdownObjekt.add_widget(DropdownUnterbutton)

        
        ButtonMenu1 = DropdownObjektButton
        return ButtonMenu1 


        
    def tischerstellung (self, Zielwidget, AnzahlTische, Auswahlliste, BackgroundcolorListe):
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(0,0,1,1),(1,1,0,1)]
        Aktionsliste = [self.bestellung, self.abrechnung, self.bestellungaendern, self.tischbenennen]
        
        #self.DropdownObjects = []
        for i in range(AnzahlTische):
            if self.Tischliste != []:
                LetzterTisch = self.Tischliste[-1]['Nummer']
##                print LetzterTisch + 1
            else:
                LetzterTisch = 0
            
            TischNr = str(LetzterTisch+1)
            TischButtonText = "T " + TischNr
            DropdownObjekt = CustomDropDown() #von kovak hinzugefuegt
            #DropdownObjektButton = CustomButton(text = TischButtonText,
            DropdownObjektButton = ToggleButton(text = TischButtonText,
                                                group='Tische',
                                                #background_normal='bilder_oberflaeche/white2.png',
                                                background_normal='bilder_oberflaeche/buttonbackground_normal_gruenrandaussenbraun.png',
                                                background_down='bilder_oberflaeche/buttonbackground_normal_weissrandaussenbraun.png',
                                                #background_down='bilder_oberflaeche/white4.png',
                                                #background_color = (0.79, 0.39, 0.09, 1))#0.6))
                                                background_color = (1, 1, 1, 1))#0.6))
            Zielwidget.add_widget(DropdownObjektButton)
            DropdownObjektButton.bind(on_release=DropdownObjekt.open)
            self.DropdownObjects.append(DropdownObjekt) #von kovak hinzugefuegt

            for x in range(len(Auswahlliste)):

                DropdownUnterbutton = Button(text=Auswahlliste[x],
                                             id = TischNr,
                                             #auto_width='False',
                                             #width = '200sp',
                                             font_size = 15,
                                             size_hint_y=None,
                                             height=60,
                                             background_normal='bilder_oberflaeche/white2.png',
                                             background_down='bilder_oberflaeche/white3.png',
                                             background_color = BackgroundcolorListe[x],
                                             on_release = Aktionsliste[x])
                DropdownObjekt.add_widget(DropdownUnterbutton)

                #print' button', i, 'unterbutton', x



            DropdownObjektButton.text= TischButtonText
            self.TischButtondict = {'Nummer':(LetzterTisch + 1),'Objekt':DropdownObjektButton}
            self.Tischliste.append(self.TischButtondict)
            
        
    def garbagecollectortracking(self, widget):
        for i in self.Tischliste:
            a = i
            print gc.is_tracked(a)
        
        
### function for Editing a Table#######################################
    #def tischmanipulieren(self, widget):
     #   widget.text = 'mein text'
        
#### function for adding an extra table to layout ##########################

    def tischhinzufuegen(self, widget):
        
        if len(self.Tischliste) >= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
               
            
        AnzahlTische = 1
        Zielwidget = self.CustomLayoutGridLayout
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(0,0,1,1),(1,1,0,1)]
        LetzterTisch = self.Tischliste[-1]['Nummer']
        if (self.CustomLayoutGridLayout.cols * self.CustomLayoutGridLayout.rows) <= (LetzterTisch +1):
            self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows + 1
        self.tischerstellung(Zielwidget, AnzahlTische, Auswahlliste, BackgroundcolorListe)

    def tischentfernen(self, widget):
        self.Warnlabel = 0 
        if len(self.Tischliste) <= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                # obj.attr_name exists.
                
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel=1    
            print 'das ist der Letzte Tisch, der kann nicht entfernt werden'
            if self.Warnlabel == 0:
                
                self.CustomLayoutBottomLabel= Label(text='Das ist der Letzte Tisch,\n der kann nicht \n entfernt werden', text_size = self.size)
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)
            
        else:
            Zielwidget = self.CustomLayoutGridLayout
            Zielwidget.remove_widget(self.Tischliste[-1]['Objekt'])
            
            del self.Tischliste[-1]
            LetzterTisch = self.Tischliste[-1]['Nummer']
            print 'die anzahl der Tische ist nun:', LetzterTisch
        
        

        
        pass
#### function for adding a column to layout ####################################

    def spaltehinzufuegen(self, widget):
        if self.CustomLayoutGridLayout.cols >= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
                self.WarnLabel = 0 
        self.CustomLayoutGridLayout.cols = self.CustomLayoutGridLayout.cols + 1
        print 'Zeile hinzufuegen'
        

    def spalteentfernen(self, widget):
        self.Warnlabel = 0
        if self.CustomLayoutGridLayout.cols <= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                # obj.attr_name exists.
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel=1    
            print 'das ist die letzte Tischreihe, sie kann nicht entfernt werden'
            if self.Warnlabel == 0:
                
                self.CustomLayoutBottomLabel= Label(text='Das ist die letzte Tischreihe,\n sie kann nicht \n entfernt werden', text_size = self.size)
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)

        else:
            TischanzahlVerbleibend = (self.CustomLayoutGridLayout.cols -1) * self.CustomLayoutGridLayout.rows
                           
            for i in range(len(self.Tischliste[TischanzahlVerbleibend:])):
                self.CustomLayoutGridLayout.remove_widget(self.Tischliste[TischanzahlVerbleibend+ i]['Objekt'])
                
            del self.Tischliste[TischanzahlVerbleibend:]
            self.CustomLayoutGridLayout.cols = self.CustomLayoutGridLayout.cols - 1

       
#### function for adding a row to layout ####################################

    def zeilehinzufuegen(self, widget):
        if self.CustomLayoutGridLayout.rows >= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
                self.WarnLabel = 0 
        self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows + 1
        print 'Zeile hinzufuegen'
        

        

    def zeileentfernen(self, widget=None):
        self.Warnlabel = 0
        if self.CustomLayoutGridLayout.rows <= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                # obj.attr_name exists.
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel=1    
            print 'das ist die letzte Tischreihe, sie kann nicht entfernt werden'
            if self.Warnlabel == 0:
                
                self.CustomLayoutBottomLabel= Label(text='Das ist die letzte Tischreihe,\n sie kann nicht \n entfernt werden', text_size = self.size)
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)

        else:
            TischanzahlVerbleibend = (self.CustomLayoutGridLayout.rows -1) * self.CustomLayoutGridLayout.cols
                           
            for i in range(len(self.Tischliste[TischanzahlVerbleibend:])):
                self.CustomLayoutGridLayout.remove_widget(self.Tischliste[TischanzahlVerbleibend+ i]['Objekt'])
                
            del self.Tischliste[TischanzahlVerbleibend:]
            self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows - 1

    
        
    def bestellung(self, widget):
        App.my_index = -1
        
        TischNr = widget.id
        PopupFloatLayout = FloatLayout(size_hint=(1, 1))
        
        self.PopupScrollview = CustomScrollviewPopupContent()
        self.PopupScrollviewItem = CustomButton2()
        
        App.AuswahlHauptliste = App.HauptListeDictonaries
        self.PopupScrollview.data = App.AuswahlHauptliste
        
        
        #content = self.PopupScrollview.ids.content
        #item = self.PopupScrollviewItem
               
        popup = Popup(title='Bestellung für Tisch ' + str(TischNr),
                      content= PopupFloatLayout)
       
             

        BoxTop = BoxLayout(size_hint= [0.52,0.065],pos_hint={'x': 0.5, 'y': 1.005}, spacing = 5)
        ButtonExit = Button(text="Exit",
                            #pos_hint={'x': 0.825, 'y': 1.005},
                            #size_hint = [0.2,0.065],
                            size_hint = [0.3,1],
                            #on_release = self.zeromyindex,
                            
                            on_release = popup.dismiss)
        #myindexzero = 0
        #ButtonExit.bind(on_release=ButtonExit.setter('myindexzero'))
        #print App.my_index

        self.ButtonSpinner =Spinner(text= "Alle",
                               values= ("Mittag-Essen", "Getraenke", "AlcGetraenke", "Essen Alltime", "Alle"),
                               size_hint= [0.7,1],
                               #pos_hint={'x': 0.625, 'y': 1.005}
                               )
        self.ButtonSpinner.bind(text=self.show_selected_value)        
        #halign: 'right'
        #valign: 'top'

        #PopupFloatLayout.add_widget(ButtonExit)
        #PopupFloatLayout.add_widget(ButtonSpinner)
        
        BoxTop.add_widget(self.ButtonSpinner)
        BoxTop.add_widget(ButtonExit)
        PopupFloatLayout.add_widget(BoxTop)
        
        self.PopupScrollview.size_hint = [1.05,1.017]
        self.PopupScrollview.center = popup.center
        PopupFloatLayout.add_widget(self.PopupScrollview)
        for i in App.ScrollviewButtons:
            i.ids.customID.on_release = self.Optionsfenster
        
       
        popup.open()
        print App.ScrollviewButtons
    
        

##        
##    def on_data(self, instance, value):
##        content_add = self.PopupScrollview.ids.content.add_widget
##        for item in value:
##            print item
##            content_add(CustomButton2(text=item))

        #return CustomScrollviewPopupContent()

        
    def show_selected_value(self, spinner, text):
        print 'The spinner', spinner, 'have text', text
        App.AuswahlHauptliste=[]
        if text == 'Alle':
            App.AuswahlHauptliste = App.HauptListeDictonaries
            self.PopupScrollview.data = App.AuswahlHauptliste
        else:
            for i in App.HauptListeDictonaries:
                if i['Kategorie'] == text:
                    App.AuswahlHauptliste.append(i)
                else:
                    continue

            self.PopupScrollview.data = App.AuswahlHauptliste
        
            
    

   


        
    def zeromyindex(self, widget):
        App.my_index = (-1)
        

    def Optionsfenster(self):
        self.OptionenPopupBestellungen = OptionenPopupBestellungen()
        
        print 'App.AktuelleBestellungProduktAnzahlzaehler', App.AktuelleBestellungProduktAnzahlzaehler
        for i in range(App.AktuelleBestellungProduktAnzahlzaehler):
            self.OptionenPopupBestellungen.ids.OptionsPopupContent.add_widget(ToggleButton(text=i))

        self.OptionenPopupBestellungen.open()
        
        
            
            
               

        

    def groesse(self,widget):
        print 'die buttongroesse ist:', widget.size

    

    def abrechnung(self, widget):
        TischNr = widget.id
        PopupFloatLayout = FloatLayout()       
        self.ScreenmanagerPopup = CustomScreenManager()
        self.ScreenPopup = CustomScreen
        
        for x in xrange(4):
            self.ScreenmanagerPopup.add_widget(self.ScreenPopup(name='Screen %d' % x))
        #popup = Popup(title='Abrechnung für ' + str(TischNr),
        #              content=self.ScreenmanagerPopup,size_hint=(1, 1) )
        popup = Popup(title='Abrechnung für Tisch' + str(TischNr),
                      content=PopupFloatLayout)#,
                      #size_hint=(1, 1),
                      #pos_hint={'x': 0.5, 'y': 0.5} )

        self.ScreenmanagerPopup.pos_hint = {'x': 0, 'y': 0} 
        PopupFloatLayout.add_widget(self.ScreenmanagerPopup)

        ButtonExit = Button(text="Exit",
                            pos_hint={'x': 0.8, 'y': 1.005},
                            size_hint = [0.2,0.065],
                            on_release = popup.dismiss)
        PopupFloatLayout.add_widget(ButtonExit)

        popup.open()
        

    def bestellungaendern(self, widget):
        pass

    def tischbenennen(self, widget):
        TischNr = widget.id
        PopupBox1LayoutTischBennenen = BoxLayout(orientation = 'vertical')
        popup = Popup(title='Tisch Nr. ' + str(TischNr) + 'benennen',
                      content=PopupBox1LayoutTischBennenen,
                      size_hint=(0.75, 0.5))
        EingabeTextfeld = TextInput(text='hier Tischbezeichnung eintragen - Funktion muss noch eingebaut werden')            
        PopupBox1LayoutTischBennenen.add_widget(EingabeTextfeld)
        PopupBoxLayoutTischBenennen = BoxLayout(orientation = 'horizontal', size_hint=(1,1))
        ButtonAbbrechenTischBenennen = Button(text="Abbrechen", size_hint=(0.5, 0.5))
        ButtonAbbrechenTischBenennen.bind(on_press=popup.dismiss)
        ButtonOkTischBenennen = Button(text="OK", size_hint=(0.5, 0.5))
        ButtonOkTischBenennen.bind(on_press=popup.dismiss)
        PopupBox1LayoutTischBennenen.add_widget(PopupBoxLayoutTischBenennen)
        PopupBoxLayoutTischBenennen.add_widget(ButtonAbbrechenTischBenennen)
        PopupBoxLayoutTischBenennen.add_widget(ButtonOkTischBenennen)
        #popup.add_widget
        popup.open()
        
        pass

      



#### function for exporting Data to file ####################################

    def datenpickeln(self):
        
        filechooser = self.PopupDateiAuswaehlenSpeichernInst.ids.b.ids.filechooser
        AusgewaehlteDatei = str(filechooser.selection)
        AusgewaehlteDatei = (AusgewaehlteDatei)[AusgewaehlteDatei.find('Produktlisten'):-2]
        if self.FileSaveTextInput.text != '':
            print 'Du hast einen Dateinamen eingegeben'
            AusgewaehlteDatei = 'Produktlisten/'+(str(self.FileSaveTextInput.text))
        print 'Daten Speichern ausgefuehrt'
        print AusgewaehlteDatei
        SicherungsItem1 = self.HauptCarousel2.Texteingabe.text
        SicherungsItem2 = App.HauptListeDictonaries
        Sicherungsliste = [SicherungsItem1, SicherungsItem2]
        
        '''function to pickle data to make it ready for sending'''
        try:
            with open(AusgewaehlteDatei, 'w+b') as SicherungslisteDaten_File:
                pickle.dump(Sicherungsliste, SicherungslisteDaten_File)
        except IOError as err:
            print('Dateifehler: ' + str(err))
        except pickle.PickleError as perr:
            print('Pickling Fehler: ' + str(perr))

	#### function for importing Data to file ####################################

    def datenentpickeln(self):
        filechooser = self.PopupDateiAuswaehlenInst.ids.b.ids.filechooser
        AusgewaehlteDatei = str(filechooser.selection)
        print 'Daten Laden ausgefuehrt'
        print AusgewaehlteDatei
        AusgewaehlteDatei = (AusgewaehlteDatei)[AusgewaehlteDatei.find('Produktlisten'):-2]
        #App.datenentpickeln = self(datenentpickeln(widget = None))
        with open(AusgewaehlteDatei, 'rb') as SicherungslisteDaten_File_entpickelt:
            SicherungslisteWiederhergestellt = pickle.load(SicherungslisteDaten_File_entpickelt)
            #self.HauptCarousel3.Textausgabe.text = SicherungslisteWiederhergestellt[0]
            App.HauptListeDictonaries = SicherungslisteWiederhergestellt[1]
##            App.AuswahlHauptListe = App.HauptListeDictonaries
##            self.ProduktOrganizerInstanz.ids.custScrlInst.data = App.AuswahlHauptListe
        self.produktorganizerfilter(self) 
        print 'die daten wurden wieder hergestellt'
Esempio n. 51
0
class gfsViewerApp(App):
	global values
	global regions

	#init App class
	def __init__(self, **kwargs):
		super(gfsViewerApp, self).__init__(**kwargs)
		
		self.carousel = Carousel(direction='right',anim_move_duration=0.1, anim_type='in_out_sine',loop='false')
		self.active_region = "M-Europa"
		self.active_value = "3h Niederschlag"
		self.last_df = 0
		self.image = []
		self.limit = 0
		self.pb = ""
		self.src = ""

		Loader.start()

	# Loader-complete callback (for some reason AsyncImage got stuck 
	# when fed with to many request at once, so images get loaded here 
	# on after the other..
	def _image_loaded(self, proxyImage):

		if proxyImage.image.texture:
				if len(self.image) > self.loadnum:
					self.image[self.loadnum].texture = proxyImage.image.texture
			
					if (self.loadnum < self.limit):
						self.loadnum = self.loadnum + 1
						self._load_next()				
					self.carousel.canvas.ask_update()
	
	# load next image			
	def _load_next(self,*largs):	
		
		if (self.loadnum < self.limit):
			
			# for some reason to many events where fired, so ignore
			# calls that don't have a unique timestamp
			
			if (len(largs) >0 ):
				if self.last_df == largs[0]:
					ignore = True
				else:
					ignore = False
					self.last_df = largs[0]
			else:
				ignore = False
				
			if not ignore:

				#gif images make trouble, conversion happens on server
				
				src = self.src  %  \
					( regions[self.active_region], ((self.loadnum +1) * self.steps), values.index(self.active_value) + 1)						
			
				proxyImage = Loader.image(src)	
				
				# we already have that image in cache
				if proxyImage.loaded:
					self.image.append(Image())
					self.image[self.loadnum].texture = proxyImage.image.texture
					self.carousel.add_widget(self.image[self.loadnum])
					self.loadnum = self.loadnum + 1
					self._load_next()
					
				# load image in background.						
				else:
					proxyImage.bind(on_load=self._image_loaded)
					self.image.append(Image())
					self.image[self.loadnum].texture = proxyImage.image.texture
					self.carousel.add_widget(self.image[self.loadnum])				
				
				#update widget..
				self.carousel.canvas.ask_update()

		# update progress bar
		self.pb.value =  (self.loadnum) / float(self.limit)  * 100
		self.ltext.text  = "total: + %dh" % ((self.loadnum) * self.steps)

        
	def _load_values(self,*largs):	
		
		if (len(largs) > 0 and self.last_df != 0):
			if self.last_df == largs[0]:
				ignore = True
			else:
				ignore = False
				self.last_df = largs[0]
		else:
			ignore = False

		# for some reason to many events where fired, so ignore
		# calls that don't have a unique timestamp
					
		if not ignore:		
			if self.active_region == "M-Europa":
				self.steps = 3
				self.limit = 60
				
			else:
				self.steps = 6
				self.limit = 30
				
			
			if self.active_region in ["M-Europa","Europa"]:
				self.src = "http://m.ash.to/gfsViewer/imgloader.php?file=R%s%02d%d.gif&type=.png"
			else:
				self.src = "http://www.wetterzentrale.de/pics/R%s%02d%d.png" 
				
			self.loadnum = 0	
			self.image = []
			self.last_df = 0
			self._load_next(*largs)
    
	def _clear_loader(self, *largs):
		Loader.stop()
		self.carousel.clear_widgets()
		self.loadnum = 0	
		self.image = []
		self.pb.value =  0
		self.ltext.text  = "total: "
				
		# now load 
		Clock.schedule_once(self._load_values,0.2)
	
	# new value selected callback	
	def _on_value_select(self,x):
		self.carousel.clear_widgets()
		Clock.schedule_once(self._clear_loader)
		setattr(self.value_button, 'text', x)		
		self.active_value = x
	
	# region select callback		
	def _on_region_select(self,x):
		setattr(self.region_button, 'text', x)
		self.active_region = x
		self._on_value_select(self.active_value)			

	# build layout and app
	def build(self):
		
		self.icon = 'data/icon-s.png'
		self.layout = BoxLayout(orientation='vertical')
		ab = ActionBar(size_hint=(1,0.08), height="48dp")
		av = ActionView()
		av.add_widget(ActionPrevious(title=appTitle,with_previous=False, app_icon=self.icon))
		ab.add_widget(av)
		
		self.layout.add_widget(ab)

		#region_dropdown = DropDown()
		# disable drop-down options for the moment. 
		# needs more work (also different value selectors)
		#for i in regions:
		#	btn = Button(text=i,  size_hint_y=None, height="48dp")
		#	btn.bind(on_release=lambda btn: region_dropdown.select(btn.text))
		#	region_dropdown.add_widget(btn)
		#	region_dropdown.bind(on_select=lambda instance, x: self._on_region_select(x))			
		self.region_button = Button(text=self.active_region, size_hint_y=None, height="48dp")
		#self.region_button.bind(on_release=region_dropdown.open)
		self.layout.add_widget(self.region_button)	
					
		value_dropdown = DropDown()
		
		for i in range(len(values)):
			btn = Button(text=values[i], size_hint_y=None, height="48dp")
			btn.bind(on_release=lambda btn: value_dropdown.select(btn.text))
			value_dropdown.add_widget(btn)
			value_dropdown.bind(on_select=lambda instance, x: self._on_value_select(x))	
		self.value_button = Button(text=self.active_value, size_hint_y=None, height="48dp")
		self.value_button.bind(on_release=value_dropdown.open)
		self.layout.add_widget(self.value_button)		
		
		self.layout.add_widget(self.carousel)
		
		self.pb = ProgressBar(max=100,value=50, size_hint=(1,0.08),height=48)
		self.layout.add_widget(self.pb)
		self.ltext = Label(text='', size_hint_y=None,height="12dp",font_size="10dp")
		self.layout.add_widget(self.ltext)	
		self._on_value_select(self.active_value)
			
		return self.layout
Esempio n. 52
0
 def build(self):
     root = Carousel(direction='right')
     root.add_widget(MainLayout())
     root.add_widget(Notes())
     return root
Esempio n. 53
0
class LoginScreen(FloatLayout):
    # x = ListProperty([])

    # print x

    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        # gc.disable()
        self.DropdownObjects = []

        self.add_widget(
            Label(
                text="Wilkommen [color=ff3333] [sub] bei der [/sub][/color][color=3333ff][b] Bonierungs[sup][color=#098125ff]App[/sup][/b][/color]",
                markup=True,
                pos_hint={"top": 1.2},
                font_size="20sp",
            )
        )

        self.GridlayoutS1 = GridLayout(cols=2, size_hint_y=1 / 5, pos_hint={"top": 0.6})
        self.add_widget(self.GridlayoutS1)
        self.GridlayoutS1.add_widget(Label(text="User Name"))  # , size_hint_x = 0.2, size_hint_y = 0.2))
        self.username = TextInput(multiline=False)  # , size_hint_x = 0.2, size_hint_y = 0.2)
        self.username.bind(on_text_validate=self.on_enter)
        self.GridlayoutS1.add_widget(self.username)
        self.GridlayoutS1.add_widget(Label(text="password"))  # ,size_hint_x = 0.2, size_hint_y = 0.2))
        self.password = TextInput(password=True, multiline=False)  # , size_hint_x = 0.2, size_hint_y = 0.2)
        self.GridlayoutS1.add_widget(self.password)
        self.BenutzerListe = {"": ""}

        self.add_widget(
            Button(text="Einloggen", size_hint_y=1 / 5, pos_hint={"top": 0.4}, on_release=self.AbfrageLogin)
        )

        self.LabelLoginanzeiger = Label(size_hint_y=1 / 5)
        self.add_widget(self.LabelLoginanzeiger)

    def on_enter(self, instance):
        print ("User pressed enter in", instance)
        self.password.focus = True

    def AbfrageLogin(self, widget):
        Username = self.username.text
        Passwort = self.password.text
        if Username in self.BenutzerListe and Passwort == self.BenutzerListe[Username]:
            self.LabelLoginanzeiger.text = "Login korrekt"
            self.clear_widgets()
            self.HauptProgramm()

        else:
            self.LabelLoginanzeiger.text = "Login inkorrekt"

    def HauptProgramm(self, *args):
        print "das ist das Hauptprogramm"
        self.BilderListeVorlaeufer = []
        self.BilderListeVorlaeufer = os.listdir(os.getcwd() + "/pictures")
        self.Pfade = []
        for i in self.BilderListeVorlaeufer:
            Pfad = os.path.join("pictures", i)
            if os.path.isfile(Pfad) == True:
                self.Pfade.append(Pfad)
        self.HauptCarousel = Carousel(scroll_timeout=100)
        App.Pfade = self.Pfade
        self.add_widget(self.HauptCarousel)
        ####################################################################################################
        ### Erste Seite im HauptCarousel momentan mit den produktbildern
        self.HauptCarousel.FloatLayout = FloatLayout()
        self.HauptCarousel.add_widget(self.HauptCarousel.FloatLayout)
        self.HauptCarousel.FloatLayout.GridLayout = GridLayout(cols=3, pos_hint={"x": 0, "y": 0}, size_hint=[1, 0.9])
        self.HauptCarousel.FloatLayout.add_widget(self.HauptCarousel.FloatLayout.GridLayout)
        for i in range(9):
            button = Button(
                background_normal=self.Pfade[i],
                background_down="bilder_oberflaeche/1361740537_Ball Green_mitHaken.png",
                mipmap=True,
            )
            self.HauptCarousel.FloatLayout.GridLayout.add_widget(button)
        ##        self.HauptCarousel.FloatLayout.GridLayout.add_widget(Button(text='test'))
        ##        self.HauptCarousel.FloatLayout.GridLayout.add_widget(Button(text='test2'))

        #####################################################################################################
        ### 2 Seite im Hauptcarousel mit testbutton zur datei Erstellung
        ### 2 Page in MainCarousel with testbutton for creating /exporting to a file
        self.HauptCarousel2 = BoxLayout(orientation="vertical")
        ###############self.HauptCarousel.add_widget(self.HauptCarousel2)
        self.HauptCarousel2.Texteingabe = TextInput(multiline=True)
        self.HauptCarousel2.add_widget(self.HauptCarousel2.Texteingabe)

        self.HauptCarousel2.ButtonSchreiben = Button(text="datei schreiben", on_release=self.datenpickeln)
        self.HauptCarousel2.add_widget(self.HauptCarousel2.ButtonSchreiben)
        #######################################################################
        ### 3 Seite im Hauptcarousel momentan mit Datei Auslesefunktion
        ### 3 Page in MainCarousel atm with functionality to read from file
        self.HauptCarousel3 = BoxLayout(orientation="vertical")
        ######################self.HauptCarousel.add_widget(self.HauptCarousel3)
        self.HauptCarousel3.Textausgabe = TextInput(multiline=True, readonly=True)
        self.HauptCarousel3.add_widget(self.HauptCarousel3.Textausgabe)

        self.HauptCarousel3.ButtonLesen = Button(text="datei auslesen", on_release=self.datenentpickeln)
        self.HauptCarousel3.add_widget(self.HauptCarousel3.ButtonLesen)
        #######################################################################
        ### 4 Seite im Hauptcarousel momentan mit Tischmanager
        ### 4 Page in Maincarousel atm with some kind of Table Manager
        BackgroundcolorListe = [(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1), (1, 1, 0, 1)]
        self.CustomLayout = CustomLayout()
        self.HauptCarousel.add_widget(self.CustomLayout)
        # self.CustomLayout.TopLabel = Label(text = 'Tisch[sup][color=#098125ff]Organizer[/sup][/b][/color]',  markup = True,
        # halign= 'left', valign= 'top', text_size= self.size, pos_hint={'x':0, 'y': 0}, font_size= '30sp')
        self.CustomLayout.TopLabel = Label(
            text="Tisch[sup][color=#098125ff]Organizer[/sup][/b][/color]", markup=True, halign="left", font_size="30sp"
        )
        # self.CustomLayout.add_widget(self.CustomLayout.TopLabel)
        self.CustomLayout.BoxLayout = BoxLayout(
            orientation="horizontal", size_hint=[1, 0.05], pos_hint={"x": 0, "y": 0.95}
        )
        self.CustomLayout.add_widget(self.CustomLayout.BoxLayout)
        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.TopLabel)
        ButtonMenu1 = self.DropdownbuttonCreator()

        self.CustomLayout.BoxLayout.Button1 = ButtonMenu1
        ##        self.CustomLayout.BoxLayout.Button2 = Button(text = 'Tisch+' , on_release = self.tischhinzufuegen)
        ##        self.CustomLayout.BoxLayout.Button3 = Button(text = 'Spalte+', on_release = self.spaltehinzufuegen)
        ##        self.CustomLayout.BoxLayout.Button4 = Button(text = 'Zeile+', on_release = self.zeilehinzufuegen)
        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button1)
        ##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button2)
        ##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button3)
        ##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button4)
        self.CustomLayoutGridLayout = GridLayout(
            cols=3, rows=4, padding=[20, 20], spacing=[30, 30], size_hint=[1, 0.95], pos_hint={"x": 0, "y": 0}
        )
        # cGridLayout = StackLayout(orientation = "tb-lr", padding = [20,20], spacing = [30,30], size_hint = [1,0.9], pos_hint={'x':0, 'y': 0})

        self.CustomLayout.add_widget(self.CustomLayoutGridLayout)
        self.Tischliste = []

        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]

        AnzahlTische = 12
        Zielwidget = self.CustomLayoutGridLayout
        self.tischerstellung(Zielwidget, AnzahlTische, Auswahlliste, BackgroundcolorListe)

        self.ProduktOrganizerInstanz = ProduktOrganizer()
        self.HauptCarousel.add_widget(self.ProduktOrganizerInstanz)
        ButtonHinzufuegen = self.ProduktOrganizerInstanz.ids.ProduktlisteButtonHinzufuegen
        ButtonHinzufuegen.on_release = self.produkthinzufuegen
        self.PopupInst = PopupBildAuswaehlenProduktorganizer()

        popup = self.PopupInst.ids.a
        self.ProduktOrganizerInstanz.ids.ProduktBildAuswaehlen.on_release = popup.open

        self.CustomScrollviewProduktOrganizer = CustomScrollviewProduktOrganizer
        self.CustomScrollviewProduktOrganizerInstanz = CustomScrollviewProduktOrganizer()
        self.ProduktOrganizerItemInstanz = CustomScrollviewItem()
        self.ProduktOrganizerInstanz.add_widget(Button(text="test", on_release=self.listeaktualisieren))
        # self.ProduktOrganizerInstanz.ids.ProduktlisteButtonHinzufuegen.on_release = self.listeaktualisieren
        self.ProduktOrganizerInstanz.add_widget(Button(text="manuell", on_release=self.itemmanuellhinzufuegen))
        self.ProduktOrganizerInstanz.add_widget(Button(text="listeaktualisiern+pos", on_release=self.positionenzeigen))

    def itemmanuellhinzufuegen(self, widget):
        self.CustomScrollviewProduktOrganizerInstanz = CustomScrollviewProduktOrganizer()
        # print dir(self.CustomScrollviewProduktOrganizerInstanz.ids.content2.children)
        self.CustomScrollviewProduktOrganizerInstanz.ids.content2.clear_widgets()
        self.testButtonx = Button(text="testbutton", size_hint=(1, 1))
        # self.CustomScrollviewProduktOrganizerInstanz.ids.content2.add_widget(self.testButtonx)
        # print dir(self.CustomScrollviewProduktOrganizerInstanz.ids)

    def positionenzeigen(self, widget):
        # print self.testButtonx.pos
        # print self.testButtonx.size
        self.listeaktualisieren(self)

    def listeaktualisieren(self, widget):
        # print 'listeacktualisieren wurde ausgefuert'
        # self.CustomScrollviewProduktOrganizer = CustomScrollviewProduktOrganizer()
        # print [str(i) for i in range(30)]
        # self.CustomScrollviewProduktOrganizerInstanz.data = ['0','1','2','3','4']
        self.CustomScrollviewProduktOrganizerInstanz.data = [str(i) for i in App.HauptListeDictonaries]
        # print dir(self.CustomScrollviewProduktOrganizer.children)#content2.clear_widgets()

    def produkthinzufuegen(self):

        NeuesDict = {}

        WertEingabeFeldBezeichnung = self.ProduktOrganizerInstanz.ids.EingabeFeldBezeichnung.text
        WertEingabeFeldPreis = self.ProduktOrganizerInstanz.ids.EingabeFeldPreis.text
        ##        StatusCheckBoxVerkauf = self.ProduktOrganizerInstanz.ids.CheckBoxVerkauf.active
        WertSpinnerKategorie = self.ProduktOrganizerInstanz.ids.SpinnerKategorie.text
        filechooser = self.PopupInst.ids.filechooser
        DateiAuswahl = (str(filechooser.selection))[((str(filechooser.selection)).find("/pictures")) : -2]
        # print 'hallo', WertEingabeFeldBezeichnung, WertEingabeFeldPreis,DateiAuswahl,WertSpinnerKategorie
        NeuesDict = {
            "Bezeichnung": WertEingabeFeldBezeichnung,
            "Preis": WertEingabeFeldPreis,
            "Bild": DateiAuswahl,
            "Kategorie": WertSpinnerKategorie,
        }

        # print 'len(App.HauptListeDictonaries)', (len(App.HauptListeDictonaries))
        if len(App.HauptListeDictonaries) < 1:
            App.HauptListeDictonaries.append(NeuesDict)
            print "Fall 1"
        else:
            for i in range(len(App.HauptListeDictonaries[:])):
                print "App.HauptListeDictonaries[i][Bezeichnung] ist", App.HauptListeDictonaries[i]["Bezeichnung"]
                Bezeichnungdict = str(App.HauptListeDictonaries[i]["Bezeichnung"])
                Bezeichnungneuesdict = str(NeuesDict["Bezeichnung"])
                if Bezeichnungdict == Bezeichnungneuesdict:

                    Treffer = True
                    break
                else:
                    Treffer = False
            if Treffer == True:
                # print 'Dieses Produkt existiert schon'
                ButtonVerstanden = Button(text="Verstanden")
                popup = Popup(
                    title="Dieses Produkt existiert bereits ", size_hint=(0.5, 0.25), content=ButtonVerstanden
                )
                popup.open()
                ButtonVerstanden.on_release = popup.dismiss
            else:
                App.HauptListeDictonaries.append(NeuesDict)

        print len(App.HauptListeDictonaries)
        for index, item in enumerate(App.HauptListeDictonaries):
            print index, item

    def DropdownbuttonCreator(self):
        Auswahlliste = ["Tisch +", "Tisch -", "Spalte + ", "Spalte -", "Reihe + ", "Reihe -"]
        BackgroundcolorListe = [(0, 1, 0, 1), (1, 0, 0, 1), (0, 1, 0, 1), (1, 0, 0, 1), (0, 1, 0, 1), (1, 0, 0, 1)]
        Aktionsliste = [
            self.tischhinzufuegen,
            self.tischentfernen,
            self.spaltehinzufuegen,
            self.spalteentfernen,
            self.zeilehinzufuegen,
            self.zeileentfernen,
        ]
        DropdownObjekt = CustomDropDown()
        DropdownObjektButton = CustomButton(
            text="Menue",
            # DropdownObjektButton = ToggleButton(text="Menue",
            size_hint=[1, 1],
            background_color=(0.8, 0.8, 0.00, 1),
            background_normal="bilder_oberflaeche/white2.png",
            background_down="bilder_oberflaeche/white3.png",
        )
        # self.CustomLayout.add_widget(DropdownObjektButton)
        DropdownObjektButton.bind(on_release=DropdownObjekt.open)
        self.DropdownObjects.append(DropdownObjekt)
        for x in range(len(Auswahlliste)):

            DropdownUnterbutton = Button(
                text=Auswahlliste[x],
                font_size=15,
                size_hint_y=None,
                height=60,
                background_color=BackgroundcolorListe[x],
                background_normal="bilder_oberflaeche/white2.png",
                background_down="bilder_oberflaeche/white3.png",
                opacity=0.8,
                on_release=Aktionsliste[x],
            )
            DropdownObjekt.add_widget(DropdownUnterbutton)

        ButtonMenu1 = DropdownObjektButton
        return ButtonMenu1

    def tischerstellung(self, Zielwidget, AnzahlTische, Auswahlliste, BackgroundcolorListe):
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        BackgroundcolorListe = [(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1), (1, 1, 0, 1)]
        Aktionsliste = [self.bestellung, self.abrechnung, self.bestellungaendern, self.tischbenennen]

        # self.DropdownObjects = []
        for i in range(AnzahlTische):
            if self.Tischliste != []:
                LetzterTisch = self.Tischliste[-1]["Nummer"]
            ##                print LetzterTisch + 1
            else:
                LetzterTisch = 0

            TischNr = str(LetzterTisch + 1)
            TischButtonText = "T " + TischNr
            DropdownObjekt = CustomDropDown()  # von kovak hinzugefuegt
            # DropdownObjektButton = CustomButton(text = TischButtonText,
            DropdownObjektButton = ToggleButton(
                text=TischButtonText,
                group="Tische",
                background_normal="bilder_oberflaeche/white2.png",
                background_down="bilder_oberflaeche/white4.png",
                background_color=(0.79, 0.39, 0.09, 0.6),
            )
            Zielwidget.add_widget(DropdownObjektButton)
            DropdownObjektButton.bind(on_release=DropdownObjekt.open)
            self.DropdownObjects.append(DropdownObjekt)  # von kovak hinzugefuegt

            for x in range(len(Auswahlliste)):

                DropdownUnterbutton = Button(
                    text=Auswahlliste[x],
                    id=TischNr,
                    # auto_width='False',
                    # width = '200sp',
                    font_size=15,
                    size_hint_y=None,
                    height=60,
                    background_normal="bilder_oberflaeche/white2.png",
                    background_down="bilder_oberflaeche/white3.png",
                    background_color=BackgroundcolorListe[x],
                    on_release=Aktionsliste[x],
                )
                DropdownObjekt.add_widget(DropdownUnterbutton)

                # print' button', i, 'unterbutton', x

            DropdownObjektButton.text = TischButtonText
            self.TischButtondict = {"Nummer": (LetzterTisch + 1), "Objekt": DropdownObjektButton}
            self.Tischliste.append(self.TischButtondict)

    def garbagecollectortracking(self, widget):
        for i in self.Tischliste:
            a = i
            print gc.is_tracked(a)

    ### function for Editing a Table#######################################
    # def tischmanipulieren(self, widget):
    #   widget.text = 'mein text'

    #### function for adding an extra table to layout ##########################

    def tischhinzufuegen(self, widget):

        if len(self.Tischliste) >= 1:
            if hasattr(self, "CustomLayoutBottomLabel"):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)

        AnzahlTische = 1
        Zielwidget = self.CustomLayoutGridLayout
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        BackgroundcolorListe = [(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1), (1, 1, 0, 1)]
        LetzterTisch = self.Tischliste[-1]["Nummer"]
        if (self.CustomLayoutGridLayout.cols * self.CustomLayoutGridLayout.rows) <= (LetzterTisch + 1):
            self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows + 1
        self.tischerstellung(Zielwidget, AnzahlTische, Auswahlliste, BackgroundcolorListe)

    def tischentfernen(self, widget):
        self.Warnlabel = 0
        if len(self.Tischliste) <= 1:
            if hasattr(self, "CustomLayoutBottomLabel"):
                # obj.attr_name exists.

                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel = 1
            print "das ist der Letzte Tisch, der kann nicht entfernt werden"
            if self.Warnlabel == 0:

                self.CustomLayoutBottomLabel = Label(
                    text="Das ist der Letzte Tisch,\n der kann nicht \n entfernt werden", text_size=self.size
                )
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)

        else:
            Zielwidget = self.CustomLayoutGridLayout
            Zielwidget.remove_widget(self.Tischliste[-1]["Objekt"])

            del self.Tischliste[-1]
            LetzterTisch = self.Tischliste[-1]["Nummer"]
            print "die anzahl der Tische ist nun:", LetzterTisch

        pass

    #### function for adding a column to layout ####################################

    def spaltehinzufuegen(self, widget):
        if self.CustomLayoutGridLayout.cols >= 1:
            if hasattr(self, "CustomLayoutBottomLabel"):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
                self.WarnLabel = 0
        self.CustomLayoutGridLayout.cols = self.CustomLayoutGridLayout.cols + 1
        print "Zeile hinzufuegen"

    def spalteentfernen(self, widget):
        self.Warnlabel = 0
        if self.CustomLayoutGridLayout.cols <= 1:
            if hasattr(self, "CustomLayoutBottomLabel"):
                # obj.attr_name exists.
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel = 1
            print "das ist die letzte Tischreihe, sie kann nicht entfernt werden"
            if self.Warnlabel == 0:

                self.CustomLayoutBottomLabel = Label(
                    text="Das ist die letzte Tischreihe,\n sie kann nicht \n entfernt werden", text_size=self.size
                )
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)

        else:
            TischanzahlVerbleibend = (self.CustomLayoutGridLayout.cols - 1) * self.CustomLayoutGridLayout.rows

            for i in range(len(self.Tischliste[TischanzahlVerbleibend:])):
                self.CustomLayoutGridLayout.remove_widget(self.Tischliste[TischanzahlVerbleibend + i]["Objekt"])

            del self.Tischliste[TischanzahlVerbleibend:]
            self.CustomLayoutGridLayout.cols = self.CustomLayoutGridLayout.cols - 1

    #### function for adding a row to layout ####################################

    def zeilehinzufuegen(self, widget):
        if self.CustomLayoutGridLayout.rows >= 1:
            if hasattr(self, "CustomLayoutBottomLabel"):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
                self.WarnLabel = 0
        self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows + 1
        print "Zeile hinzufuegen"

    def zeileentfernen(self, widget):
        self.Warnlabel = 0
        if self.CustomLayoutGridLayout.rows <= 1:
            if hasattr(self, "CustomLayoutBottomLabel"):
                # obj.attr_name exists.
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel = 1
            print "das ist die letzte Tischreihe, sie kann nicht entfernt werden"
            if self.Warnlabel == 0:

                self.CustomLayoutBottomLabel = Label(
                    text="Das ist die letzte Tischreihe,\n sie kann nicht \n entfernt werden", text_size=self.size
                )
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)

        else:
            TischanzahlVerbleibend = (self.CustomLayoutGridLayout.rows - 1) * self.CustomLayoutGridLayout.cols

            for i in range(len(self.Tischliste[TischanzahlVerbleibend:])):
                self.CustomLayoutGridLayout.remove_widget(self.Tischliste[TischanzahlVerbleibend + i]["Objekt"])

            del self.Tischliste[TischanzahlVerbleibend:]
            self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows - 1

    def bestellung(self, widget):

        TischNr = widget.id
        PopupFloatLayout = FloatLayout(size_hint=(1, 1))

        self.PopupScrollview = CustomScrollviewPopupContent()
        self.PopupScrollviewItem = CustomButton2()
        self.PopupScrollview.data = [str(i) for i in range(10)]
        # content = self.PopupScrollview.ids.content
        # item = self.PopupScrollviewItem

        popup = Popup(title="Bestellung für Tisch " + str(TischNr), content=PopupFloatLayout)

        ##        for i in range(9):
        ##            content.add_widget(CustomButton(text = str(i)))

        # self.PopupScrollview.ids.CSPopup.open()
        # print dir(CustomScrollviewPopupContent.data)
        ButtonExit = Button(
            text="Exit", pos_hint={"x": 0.825, "y": 1.005}, size_hint=[0.2, 0.065], on_release=popup.dismiss
        )

        PopupFloatLayout.add_widget(ButtonExit)
        self.PopupScrollview.size_hint = [1.05, 1.017]
        self.PopupScrollview.center = popup.center
        PopupFloatLayout.add_widget(self.PopupScrollview)
        self.PopupScrollview.ids.populate.on_release = self.kasse

        popup.open()

    ##
    ##    def on_data(self, instance, value):
    ##        content_add = self.PopupScrollview.ids.content.add_widget
    ##        for item in value:
    ##            print item
    ##            content_add(CustomButton2(text=item))

    # return CustomScrollviewPopupContent()

    def kasse(self):

        self.PopupScrollview.data = [str(i) for i in range(30)]
        # print dir(CustomScrollviewPopupContent().ids.viewitems)
        # y.ids.content.clear_widgets()

    ##        x.data = ListProperty([str(i) for i in range(10)])
    ##        print 'x.data', x.data
    ##
    ##        print CustomScrollviewPopupContent.data
    ##        CustomScrollviewPopupContent.data = x.data
    ##        print '2ens', CustomScrollviewPopupContent.data

    def groesse(self, widget):
        print "die buttongroesse ist:", widget.size

    def abrechnung(self, widget):
        TischNr = widget.id
        PopupFloatLayout = FloatLayout()
        self.ScreenmanagerPopup = CustomScreenManager()
        self.ScreenPopup = CustomScreen

        for x in xrange(4):
            self.ScreenmanagerPopup.add_widget(self.ScreenPopup(name="Screen %d" % x))
        # popup = Popup(title='Abrechnung für ' + str(TischNr),
        #              content=self.ScreenmanagerPopup,size_hint=(1, 1) )
        popup = Popup(title="Abrechnung für Tisch" + str(TischNr), content=PopupFloatLayout)  # ,
        # size_hint=(1, 1),
        # pos_hint={'x': 0.5, 'y': 0.5} )

        self.ScreenmanagerPopup.pos_hint = {"x": 0, "y": 0}
        PopupFloatLayout.add_widget(self.ScreenmanagerPopup)

        ButtonExit = Button(
            text="Exit", pos_hint={"x": 0.8, "y": 1.005}, size_hint=[0.2, 0.065], on_release=popup.dismiss
        )
        PopupFloatLayout.add_widget(ButtonExit)

        popup.open()

    def bestellungaendern(self, widget):
        pass

    def tischbenennen(self, widget):
        TischNr = widget.id
        PopupBox1LayoutTischBennenen = BoxLayout(orientation="vertical")
        popup = Popup(
            title="Tisch Nr. " + str(TischNr) + "benennen", content=PopupBox1LayoutTischBennenen, size_hint=(0.75, 0.5)
        )
        EingabeTextfeld = TextInput(text="hier Tischbezeichnung eintragen - Funktion muss noch eingebaut werden")
        PopupBox1LayoutTischBennenen.add_widget(EingabeTextfeld)
        PopupBoxLayoutTischBenennen = BoxLayout(orientation="horizontal", size_hint=(1, 1))
        ButtonAbbrechenTischBenennen = Button(text="Abbrechen", size_hint=(0.5, 0.5))
        ButtonAbbrechenTischBenennen.bind(on_press=popup.dismiss)
        ButtonOkTischBenennen = Button(text="OK", size_hint=(0.5, 0.5))
        ButtonOkTischBenennen.bind(on_press=popup.dismiss)
        PopupBox1LayoutTischBennenen.add_widget(PopupBoxLayoutTischBenennen)
        PopupBoxLayoutTischBenennen.add_widget(ButtonAbbrechenTischBenennen)
        PopupBoxLayoutTischBenennen.add_widget(ButtonOkTischBenennen)
        # popup.add_widget
        popup.open()

        pass

    #### function for exporting Data to file ####################################

    def datenpickeln(self, widget):
        BonListe = self.HauptCarousel2.Texteingabe.text
        """function to pickle data to make it ready for sending"""
        try:
            with open("bonliste.txt", "w+b") as BonListeDaten_File:
                pickle.dump(BonListe, BonListeDaten_File)
        except IOError as err:
            print ("Dateifehler: " + str(err))
        except pickle.PickleError as perr:
            print ("Pickling Fehler: " + str(perr))

    #### function for importing Data to file ####################################

    def datenentpickeln(self, widget):
        with open("bonliste.txt", "rb") as BonListeDaten_File_entpickelt:
            BonListeWiederhergestellt = pickle.load(BonListeDaten_File_entpickelt)

        print "die entpickelte BinListe ist: "
        print BonListeWiederhergestellt
        BonListe = BonListeWiederhergestellt
        self.HauptCarousel3.Textausgabe.text = BonListe
Esempio n. 54
0
 def build(self):
     karinca = Carousel()
     for i in range(5):
         karinca.add_widget(Label(text="Karınca Sayfası: %d" %i))
         
     return karinca
Esempio n. 55
0
    def on_activated(self,*args):
        super(VirtualScreenManagerStack, self).on_activated(*args)
        print 'on activated', self.activated, self.current_screen
        SCALE = .6 if self.activated else 1
        if self.activated:
            self.clear_widgets()
            grid = Carousel(size_hint = (1,1), width=.8*Window.width, x=.1*Window.width, direction="bottom")
            FloatLayout.add_widget(self,grid)
        for wrapper in self.wrappers.values():
            print 'before', wrapper.size
            wrapper.scale=SCALE
            print 'after', wrapper.size
            if self.activated:
                wrapper.size_hint= None, None
                print 'adding wrapper of ', wrapper.height
                grid.add_widget(wrapper)
            else:
                self.children[0].remove_widget(wrapper)
        if not self.activated:
            self.clear_widgets()
            w= self.wrappers[self.current_screen]
            w.pos = 0,0
            w.size_hint= 1,1
            FloatLayout.add_widget(self, w)
        else:
            print "grid", grid.size, grid.pos, grid.size_hint
        return
        if 0:
            self.clear_widgets()
            sv = ScrollView()
            with sv.canvas.before:
                Color(.3,.3,.3)
                Rectangle(size=self.size, pos=self.pos)
            FloatLayout.add_widget(self,sv)
            grid= GridLayout()
            sv.do_scroll_x = self.activated
            sv.do_scroll_y = self.activated
            grid.rows = 1 if self.orientation=='horizontal' else None
            grid.cols = 1 if self.orientation=="vertical" else None
            grid.bind(minimum_height = grid.setter('height'))
            grid.bind(minimum_width = grid.setter('width'))
            grid.spacing = self.spacing
            sv.add_widget(grid)
            SCALE = .6
                        # if self.orientation == 'vertical':
                        #     attrName = "cols"
                        #     dh_name = "row_default_height"
                        #     default_value = SCALE*self.height #300
                        #     size_hint=(1,None)
                        # else:
                        #     attrName = "rows"
                        #     dh_name = "col_default_width"
                        #     default_value = 400
                        #     size_hint=(None,1)
                        # kwargs = {attrName:2, dh_name:default_value}
                        # kwargs = {attrName:2}
                        # kwargs = {attrName:1}
                        # kwargs = {attrName:1, dh_name:default_value}
                        # if self.orientation == 'vertical':
                        #     grid.height = len(self.content)*(SCALE*self.height+self.spacing)
                        # else:
                        #     grid.width = len(self.content)*(SCALE*self.width + self.spacing)
            for sindex, screen in enumerate(self.content):
                wrapper = self.wrappers[screen]
                wrapper.size_hint = None,None
                wrapper.size = self.size
                if 1 or screen != self.current_screen:
                    wrapper.scale = SCALE
                else:
                    reducer = Animation(scale=SCALE, opacity=.5, duration=.3)
                    reducer.start(wrapper)
                grid.add_widget(wrapper)
                #Clock.schedule_once(adder,.31)
                #if self.orientation=='vertical':
                #    name = wrapper.screen_name or str(screen)
                #    grid.add_widget(MagicLabel(target= wrapper, text=name, size = wrapper.size, texture_size = (800,600), size_hint_x=None, width=60))
            ##if self.orientation =="horizontal":
            ##    for screen in self.content:
            ##        name = wrapper.screen_name or str(screen)
            ##        grid.add_widget(MagicLabel(target= wrapper, text=name, size = wrapper.size, texture_size = (800,600), size_hint_y=None, height=30))
            #scrool sv to proper height
            ##if self.orientation=="vertical":
            ##    sv.scroll_y= 1- float(self.content.index(self.current_screen))/len(self.content)
            ##else:
            ##    sv.scroll_x= float(self.content.index(self.current_screen))/len(self.content)

        else:
            sv = self.children[0]
            grid = sv.children[0]
            for screen in self.content:
                wrapper = self.wrappers[screen]
                grid.remove_widget(wrapper)
            self.clear_widgets()
            w = self.wrappers[self.current_screen]
            w.size_hint = 1,1
            FloatLayout.add_widget(self,w)
            wrapper = self.wrappers[self.current_screen]
            expander = Animation(scale = 1, opacity=1, x=0, y=0, duration=.3)
            expander.start(wrapper)
Esempio n. 56
0
 def build(self):
     root = Carousel()
     for x in xrange(10):
         root.add_widget(Page())
     return root
Esempio n. 57
0
class CalStart(Screen):
# layout
    def __init__ (self,**kwargs):
        super (CalStart, self).__init__(**kwargs)

        box = BoxLayout(size_hint_x=1, size_hint_y=1,padding=10, spacing=10, orientation='vertical')

        box1 = BoxLayout(size_hint_x=1, size_hint_y=0.5,padding=10, spacing=10, orientation='vertical')
        box2 = BoxLayout(size_hint_x=1, size_hint_y=0.5,padding=10, spacing=10, orientation='vertical')

        button_back = Button(text="Back")
        button_back.bind(on_press= self.change_to_precal)

        self.button_stream = Button(text="Start Streaming")
        self.button_stream.bind(on_press= self.bci_begin)


        self.carousel = Carousel(direction='right')
        for i in range(10):
            src = "http://placehold.it/480x270.png&text=slide-%d&.png" % i
            image = AsyncImage(source=src, allow_stretch=True)
            self.carousel.add_widget(image)

        self.label_energy = Label()


        box2.add_widget(self.carousel)

        box1.add_widget(self.label_energy)

        box1.add_widget(self.button_stream)
        box1.add_widget(button_back)

        box.add_widget(box2) 
        box.add_widget(box1) 

        self.add_widget(box)

        self.stream_flag = False

        Clock.schedule_interval(self.get_energy, 1/20)

    def change_to_precal(self,*args):
        self.manager.current = 'CalMenu'
        self.manager.transition.direction = 'right'

    def bci_begin(self,*args):

        if self.stream_flag:
            self.button_stream.text = 'Start Streaming'
            self.sm.stop_flag = True
            self.stream_flag = False
            self.label_energy.text = ""
            self.sm.join()
            self.clock_unscheduler()

        else:
            self.sm = SampleManager()
            self.sm.daemon = True
            self.button_stream.text = 'Stop Streaming'
            self.sm.stop_flag = False
            self.sm.start()
            self.stream_flag = True
            self.clock_scheduler()

    def get_energy(self, dt):
        if self.stream_flag:
            energy = self.sm.ComputeEnergy()
            if not energy == None:
                self.label_energy.text = "Energy level : {}".format(energy)

    def clock_scheduler(self):
        Clock.schedule_once(self.schedule_first_sign, 1)
        Clock.schedule_once(self.schedule_second_sign, 3)
        Clock.schedule_once(self.schedule_third_sign, 5)

    def clock_unscheduler(self):
        Clock.unschedule(self.set_sign_pause)
        Clock.unschedule(self.set_sign_left)
        Clock.unschedule(self.set_sign_right)

    def schedule_first_sign(self, dt):
        Clock.schedule_interval(self.set_sign_pause, 1)

    def schedule_second_sign(self, dt):
        Clock.schedule_interval(self.set_sign_left, 1)

    def schedule_third_sign(self, dt):
        Clock.schedule_interval(self.set_sign_right, 1)

    def set_sign_pause(self, dt):
        self.carousel.index = 0
        self.sm.MarkEvents(0)

    def set_sign_left(self, dt):
        self.carousel.index = 1
        self.sm.MarkEvents(1)

    def set_sign_right(self, dt):
        self.carousel.index = 2
        self.sm.MarkEvents(2)
Esempio n. 58
0
class L2WApp(App):
    """TODO:

    * console_layout
    * settings_layout
    * about_layout

    Also, the position of shapes on the canvas has screens overlapping
    at the moment. ScreenManager might fix this?
    """
    def build(self):
        self.changes = []
        log.startLogging(sys.stdout)
        root = self.init_ui()
        Clock.schedule_once(self.connect_to_server, 0.1)
        return root

    def init_ui(self):
        self.carousel = Carousel(direction='right')

        self.layout = BoxLayout(orientation='vertical')

        Clock.schedule_interval(self.update_ui, 1.0 / 60.0)
        self.soundboard = Soundboard()
        self.soundboard.load()

        self._init_about_layout()
        self._init_console_layout()

        self.carousel.add_widget(self.layout)
        self.carousel.add_widget(self.console_layout)
        self.carousel.add_widget(self.about_layout)
        return self.carousel

    def _init_about_layout(self):
        self.about_layout = BoxLayout(orientation='vertical')
        self.about_text = 'Listen to Wikipedia is brought to you\nby Stephen LaPorte and Mahmoud Hashemi'
        about_label = Label(text=self.about_text)
        self.about_layout.add_widget(about_label)

    def _init_console_layout(self):
        self.console_layout = BoxLayout(orientation='vertical')

    def connect_to_server(self, delta):
        factory = L2WFactory(self, "ws://listen.hatnote.com:9000", debug=False)
        reactor.connectTCP("listen.hatnote.com", 9000, factory)

    def handle_message(self, msg):
        change_item = ChangeItem(msg, app=self)
        self.changes.append(change_item)
        if msg['page_title'] == 'Special:Log/newusers':
            self.soundboard.play_new_user()
        else:
            self.soundboard.play_change(msg['change_size'])
        if len(self.console_layout.children) > 15:
            self.console_layout.remove_widget(self.console_layout.children[-1])
        self.console_layout.add_widget(Label(text=change_item.metadata['page_title']))

    def update_ui(self, dt):
        layout = self.layout
        layout.canvas.clear()
        with layout.canvas:
            cur_time = time.time()
            next_changes = []
            for change in self.changes:
                fade = ((cur_time - change.create_time) / FADEOUT_SECONDS)
                opacity = START_OPACITY - fade
                if opacity <= 0:
                    # print 'removed change', change
                    continue
                next_changes.append(change)
                color = change.rgb + (opacity,)
                Color(*color)
                Ellipse(pos=change.pos, size=(change.radius, change.radius))
            self.changes[:] = next_changes

        return
Esempio n. 59
0
class LoginScreen(FloatLayout):


    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        #gc.disable()
        self.DropdownObjects = []

        self.add_widget(Label(text= "Wilkommen [color=ff3333] [sub] bei der [/sub][/color][color=3333ff][b] Bonierungs[sup][color=#098125ff]App[/sup][/b][/color]",
                              markup = True, pos_hint={'top': 1.2}, font_size='20sp'))


        self.GridlayoutS1 = GridLayout(cols = 2, size_hint_y = 1/5, pos_hint={'top': 0.6})
        self.add_widget(self.GridlayoutS1)
        self.GridlayoutS1.add_widget(Label(text='User Name')) #, size_hint_x = 0.2, size_hint_y = 0.2))
        self.username = TextInput(multiline=False) #, size_hint_x = 0.2, size_hint_y = 0.2)
        self.username.bind(on_text_validate=self.on_enter)
        self.GridlayoutS1.add_widget(self.username)
        self.GridlayoutS1.add_widget(Label(text='password')) #,size_hint_x = 0.2, size_hint_y = 0.2))
        self.password = TextInput(password=True, multiline=False) #, size_hint_x = 0.2, size_hint_y = 0.2)
        self.GridlayoutS1.add_widget(self.password)
        self.BenutzerListe = {"": ""};

        self.add_widget(Button(text='Einloggen', size_hint_y= 1/5, pos_hint={'top': 0.4}, on_release = self.AbfrageLogin))

        self.LabelLoginanzeiger = Label(size_hint_y= 1/5)
        self.add_widget(self.LabelLoginanzeiger)

    def on_enter(self, instance):
        print('User pressed enter in', instance)
        self.password.focus = True







    def AbfrageLogin(self, widget):
        Username = self.username.text
        Passwort = self.password.text
        if Username in self.BenutzerListe and Passwort == self.BenutzerListe[Username]:
              self.LabelLoginanzeiger.text = 'Login korrekt'
              self.clear_widgets()
              self.HauptProgramm()

        else:
              self.LabelLoginanzeiger.text = 'Login inkorrekt'


    def HauptProgramm(self, *args):
        print 'das ist das Hauptprogramm'
        self.BilderListeVorlaeufer = []
        self.BilderListeVorlaeufer = os.listdir(os.getcwd() + '/pictures')
        self.Pfade = []
        for i in self.BilderListeVorlaeufer:
            Pfad = os.path.join('pictures', i)
            self.Pfade.append(Pfad)
        self.HauptCarousel = Carousel(scroll_timeout = 100)
        self.add_widget(self.HauptCarousel)
        ####################################################################################################
        ### Erste Seite im HauptCarousel momentan mit den produktbildern
        self.HauptCarousel.FloatLayout = FloatLayout()
        self.HauptCarousel.add_widget(self.HauptCarousel.FloatLayout)
        self.HauptCarousel.FloatLayout.GridLayout = GridLayout(cols=3, pos_hint={'x': 0,'y': 0}, size_hint=[1,0.9])
        self.HauptCarousel.FloatLayout.add_widget(self.HauptCarousel.FloatLayout.GridLayout)
        for i in range(9):
            button = Button(background_normal = self.Pfade[i], background_down= 'pictures/bilder_oberflaeche/1361740537_Ball Green_mitHaken.png', mipmap= True)
            self.HauptCarousel.FloatLayout.GridLayout.add_widget(button)
##        self.HauptCarousel.FloatLayout.GridLayout.add_widget(Button(text='test'))
##        self.HauptCarousel.FloatLayout.GridLayout.add_widget(Button(text='test2'))

        #####################################################################################################
        ### 2 Seite im Hauptcarousel mit testbutton zur datei Erstellung
        ### 2 Page in MainCarousel with testbutton for creating /exporting to a file
        self.HauptCarousel2 = BoxLayout(orientation='vertical')
        ###############self.HauptCarousel.add_widget(self.HauptCarousel2)
        self.HauptCarousel2.Texteingabe = TextInput(multiline=True)
        self.HauptCarousel2.add_widget(self.HauptCarousel2.Texteingabe)

        self.HauptCarousel2.ButtonSchreiben = Button(text="datei schreiben", on_release = self.datenpickeln)
        self.HauptCarousel2.add_widget(self.HauptCarousel2.ButtonSchreiben)
        #######################################################################
        ### 3 Seite im Hauptcarousel momentan mit Datei Auslesefunktion
        ### 3 Page in MainCarousel atm with functionality to read from file
        self.HauptCarousel3 = BoxLayout(orientation='vertical')
        ######################self.HauptCarousel.add_widget(self.HauptCarousel3)
        self.HauptCarousel3.Textausgabe = TextInput(multiline=True, readonly = True)
        self.HauptCarousel3.add_widget(self.HauptCarousel3.Textausgabe)

        self.HauptCarousel3.ButtonLesen = Button(text="datei auslesen", on_release = self.datenentpickeln)
        self.HauptCarousel3.add_widget(self.HauptCarousel3.ButtonLesen)
        #######################################################################
        ### 4 Seite im Hauptcarousel momentan mit Tischmanager
	### 4 Page in Maincarousel atm with some kind of Table Manager
        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(0,0,1,1),(1,1,0,1)]
        self.CustomLayout = CustomLayout()
        self.HauptCarousel.add_widget(self.CustomLayout)
        #self.CustomLayout.TopLabel = Label(text = 'Tisch[sup][color=#098125ff]Organizer[/sup][/b][/color]',  markup = True,
                                            #halign= 'left', valign= 'top', text_size= self.size, pos_hint={'x':0, 'y': 0}, font_size= '30sp')
        self.CustomLayout.TopLabel = Label(text = 'Tisch[sup][color=#098125ff]Organizer[/sup][/b][/color]',  markup = True,
                                           halign= 'left',  font_size= '30sp')
        #self.CustomLayout.add_widget(self.CustomLayout.TopLabel)
        self.CustomLayout.BoxLayout = BoxLayout (orientation = 'horizontal', size_hint = [1,0.05], pos_hint={'x':0, 'y': 0.95})
        self.CustomLayout.add_widget(self.CustomLayout.BoxLayout)
        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.TopLabel)
        ButtonMenu1 = self.DropdownbuttonCreator()
        
        self.CustomLayout.BoxLayout.Button1 = ButtonMenu1
##        self.CustomLayout.BoxLayout.Button2 = Button(text = 'Tisch+' , on_release = self.tischhinzufuegen)
##        self.CustomLayout.BoxLayout.Button3 = Button(text = 'Spalte+', on_release = self.spaltehinzufuegen)
##        self.CustomLayout.BoxLayout.Button4 = Button(text = 'Zeile+', on_release = self.zeilehinzufuegen)
        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button1)
##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button2)
##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button3)
##        self.CustomLayout.BoxLayout.add_widget(self.CustomLayout.BoxLayout.Button4)
        self.CustomLayoutGridLayout = GridLayout(cols = 3, rows = 4, padding = [20,20], spacing = [30,30], size_hint = [1,0.95], pos_hint={'x':0, 'y': 0})
        #cGridLayout = StackLayout(orientation = "tb-lr", padding = [20,20], spacing = [30,30], size_hint = [1,0.9], pos_hint={'x':0, 'y': 0})

        self.CustomLayout.add_widget(self.CustomLayoutGridLayout)
        self.Tischliste = []
        
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        
        AnzahlTische = 12
        Zielwidget = self.CustomLayoutGridLayout
        self.tischerstellung(Zielwidget,AnzahlTische, Auswahlliste, BackgroundcolorListe)
       
        
                              


        #####################################################################
        ### Versuch eines Dropdown Buttons
        ### Try to implement a dropdown Button, probably better than a Spinner
        ###############################

####        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
####        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(0,0,1,1),(1,1,0,1)]
####        self.dropdownobjects = []
####        for i in range(12):
####            TischButtonText = "T " + str(i+1)
####            DropdownObjekt = CustomDropDown() #von kovak hinzugefuegt
####            DropdownObjektButton = CustomButton(text = TischButtonText, background_color = (201./255.,99./255.,23./255.,1))
####            cGridLayout.add_widget(DropdownObjektButton)
####            DropdownObjektButton.bind(on_release=DropdownObjekt.open)
####            self.dropdownobjects.append(DropdownObjekt) #von kovak hinzugefuegt
####
####            for x in range(len(Auswahlliste)):
####
####                DropdownUnterbutton = Button(text=Auswahlliste[x], font_size = 15, size_hint_y=None, height=60, background_color = BackgroundcolorListe[x])
####                DropdownObjekt.add_widget(DropdownUnterbutton)
####
####                #print' button', i, 'unterbutton', x
####
####
####
####            DropdownObjektButton.text= TischButtonText
####            TischButtondict = {'Nummer':(i),'Objekt':DropdownObjektButton}
####            self.Tischliste.append(TischButtondict)



##        for i in range(12):
##            TischButtonText = "T " + str(i+1)
##            #TischButton = Button(text=(''), on_release = self.tischmanipulieren)
##            TischButton = Spinner(text='', values = ("Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"))
##            cGridLayout.add_widget(TischButton)
##            TischButton.text= TischButtonText
##            TischButtondict = {(i),TischButton}
##            self.Tischliste.append(TischButtondict)
##        for index, item in enumerate(self.Tischliste):
##                print index, item

    def DropdownbuttonCreator(self):
        Auswahlliste = ["Tisch +", "Tisch -", "Spalte + ", "Spalte -", "Reihe + ", "Reihe -"]
        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(1,0,0,1),(0,1,0,1),(1,0,0,1),(0,1,0,1)]
        Aktionsliste = [self.tischhinzufuegen, self.tischentfernen, self.spaltehinzufuegen, self.spalteentfernen, self.zeilehinzufuegen, self.zeileentfernen]
        DropdownObjekt = CustomDropDown()
        DropdownObjektButton = CustomButton(text = "Menue",
        #DropdownObjektButton = ToggleButton(text="Menue",
                                            size_hint=[1,1],
                                            background_color = (0.8, 0.8, 0.00, 1),
                                            background_normal='pictures/white2.png',
                                            background_down='pictures/white3.png')
        #self.CustomLayout.add_widget(DropdownObjektButton)
        DropdownObjektButton.bind(on_release=DropdownObjekt.open)
        self.DropdownObjects.append(DropdownObjekt)
        for x in range(len(Auswahlliste)):

                DropdownUnterbutton = Button(text=Auswahlliste[x], font_size = 15, size_hint_y=None, height=60,
                                             background_color = BackgroundcolorListe[x],
                                             background_normal='pictures/white2.png',
                                             background_down='pictures/white3.png',
                                             opacity = 0.8,
                                             on_release = Aktionsliste[x])
                DropdownObjekt.add_widget(DropdownUnterbutton)

        
        ButtonMenu1 = DropdownObjektButton
        return ButtonMenu1 


        
    def tischerstellung (self, Zielwidget, AnzahlTische, Auswahlliste, BackgroundcolorListe):
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(0,0,1,1),(1,1,0,1)]
        Aktionsliste = [self.bestellung, self.abrechnung, self.bestellungaendern, self.tischbenennen]
        
        #self.DropdownObjects = []
        for i in range(AnzahlTische):
            if self.Tischliste != []:
                LetzterTisch = self.Tischliste[-1]['Nummer']
##                print LetzterTisch + 1
            else:
                LetzterTisch = 0
            
            TischNr = str(LetzterTisch+1)
            TischButtonText = "T " + TischNr
            DropdownObjekt = CustomDropDown() #von kovak hinzugefuegt
            #DropdownObjektButton = CustomButton(text = TischButtonText,
            DropdownObjektButton = ToggleButton(text = TischButtonText,
                                                group='Tische',
                                                background_normal='pictures/white2.png',
                                                background_down='pictures/white4.png',
                                                background_color = (0.79, 0.39, 0.09, 0.6))
            Zielwidget.add_widget(DropdownObjektButton)
            DropdownObjektButton.bind(on_release=DropdownObjekt.open)
            self.DropdownObjects.append(DropdownObjekt) #von kovak hinzugefuegt

            for x in range(len(Auswahlliste)):

                DropdownUnterbutton = Button(text=Auswahlliste[x],
                                             id = TischNr,
                                             #auto_width='False',
                                             #width = '200sp',
                                             font_size = 15,
                                             size_hint_y=None,
                                             height=60,
                                             background_normal='pictures/white2.png',
                                             background_down='pictures/white3.png',
                                             background_color = BackgroundcolorListe[x],
                                             on_release = Aktionsliste[x])
                DropdownObjekt.add_widget(DropdownUnterbutton)

                #print' button', i, 'unterbutton', x



            DropdownObjektButton.text= TischButtonText
            self.TischButtondict = {'Nummer':(LetzterTisch + 1),'Objekt':DropdownObjektButton}
            self.Tischliste.append(self.TischButtondict)
            
        
    def garbagecollectortracking(self, widget):
        for i in self.Tischliste:
            a = i
            print gc.is_tracked(a)
        
        
### function for Editing a Table#######################################
    #def tischmanipulieren(self, widget):
     #   widget.text = 'mein text'
        
#### function for adding an extra table to layout ##########################

    def tischhinzufuegen(self, widget):
        
        if len(self.Tischliste) >= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
               
            
        AnzahlTische = 1
        Zielwidget = self.CustomLayoutGridLayout
        Auswahlliste = ["Bestellung", "Abrechnung", "Best. Aendern", "Bennenen"]
        BackgroundcolorListe = [(1,0,0,1),(0,1,0,1),(0,0,1,1),(1,1,0,1)]
        LetzterTisch = self.Tischliste[-1]['Nummer']
        if (self.CustomLayoutGridLayout.cols * self.CustomLayoutGridLayout.rows) <= (LetzterTisch +1):
            self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows + 1
        self.tischerstellung(Zielwidget, AnzahlTische, Auswahlliste, BackgroundcolorListe)

    def tischentfernen(self, widget):
        self.Warnlabel = 0 
        if len(self.Tischliste) <= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                # obj.attr_name exists.
                
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel=1    
            print 'das ist der Letzte Tisch, der kann nicht entfernt werden'
            if self.Warnlabel == 0:
                
                self.CustomLayoutBottomLabel= Label(text='Das ist der Letzte Tisch,\n der kann nicht \n entfernt werden', text_size = self.size)
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)
            
        else:
            Zielwidget = self.CustomLayoutGridLayout
            Zielwidget.remove_widget(self.Tischliste[-1]['Objekt'])
            
            del self.Tischliste[-1]
            LetzterTisch = self.Tischliste[-1]['Nummer']
            print 'die anzahl der Tische ist nun:', LetzterTisch
        
        

        
        pass
#### function for adding a column to layout ####################################

    def spaltehinzufuegen(self, widget):
        if self.CustomLayoutGridLayout.cols >= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
                self.WarnLabel = 0 
        self.CustomLayoutGridLayout.cols = self.CustomLayoutGridLayout.cols + 1
        print 'Zeile hinzufuegen'
        

    def spalteentfernen(self, widget):
        self.Warnlabel = 0
        if self.CustomLayoutGridLayout.cols <= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                # obj.attr_name exists.
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel=1    
            print 'das ist die letzte Tischreihe, sie kann nicht entfernt werden'
            if self.Warnlabel == 0:
                
                self.CustomLayoutBottomLabel= Label(text='Das ist die letzte Tischreihe,\n sie kann nicht \n entfernt werden', text_size = self.size)
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)

        else:
            TischanzahlVerbleibend = (self.CustomLayoutGridLayout.cols -1) * self.CustomLayoutGridLayout.rows
                           
            for i in range(len(self.Tischliste[TischanzahlVerbleibend:])):
                self.CustomLayoutGridLayout.remove_widget(self.Tischliste[TischanzahlVerbleibend+ i]['Objekt'])
                
            del self.Tischliste[TischanzahlVerbleibend:]
            self.CustomLayoutGridLayout.cols = self.CustomLayoutGridLayout.cols - 1

       
#### function for adding a row to layout ####################################

    def zeilehinzufuegen(self, widget):
        if self.CustomLayoutGridLayout.rows >= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                self.CustomLayout.remove_widget(self.CustomLayoutBottomLabel)
                self.WarnLabel = 0 
        self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows + 1
        print 'Zeile hinzufuegen'
        

        

    def zeileentfernen(self, widget):
        self.Warnlabel = 0
        if self.CustomLayoutGridLayout.rows <= 1:
            if hasattr(self, 'CustomLayoutBottomLabel'):
                # obj.attr_name exists.
                if self.CustomLayoutBottomLabel in self.CustomLayout.children:
                    self.Warnlabel=1    
            print 'das ist die letzte Tischreihe, sie kann nicht entfernt werden'
            if self.Warnlabel == 0:
                
                self.CustomLayoutBottomLabel= Label(text='Das ist die letzte Tischreihe,\n sie kann nicht \n entfernt werden', text_size = self.size)
                self.CustomLayout.add_widget(self.CustomLayoutBottomLabel)

        else:
            TischanzahlVerbleibend = (self.CustomLayoutGridLayout.rows -1) * self.CustomLayoutGridLayout.cols
                           
            for i in range(len(self.Tischliste[TischanzahlVerbleibend:])):
                self.CustomLayoutGridLayout.remove_widget(self.Tischliste[TischanzahlVerbleibend+ i]['Objekt'])
                
            del self.Tischliste[TischanzahlVerbleibend:]
            self.CustomLayoutGridLayout.rows = self.CustomLayoutGridLayout.rows - 1

        
        
    def bestellung(self, widget):
        TischNr = widget.id
        PopupFloatLayout = FloatLayout()
        popup = Popup(title='Bestellung für Tisch ' + str(TischNr),
                      content=PopupFloatLayout,size_hint=(1, 1) )
        
        ButtonExit = Button(text="Exit",
                            pos_hint={'x': 0.8, 'y': 1.005},
                            size_hint = [0.2,0.065],
                            on_release = popup.dismiss)
        
        PopupBoxLayout = BoxLayout(orientation='vertical', size_hint = [1.05, 1])
        
        PopupFloatLayout.add_widget(PopupBoxLayout)
        ButtonKasse = Button(text='Kasse',
                         size_hint = [1,0.08])
        PopupBoxLayout.add_widget(ButtonKasse)
        HoeheUebrig = PopupFloatLayout.height - sum(child.height for child in PopupFloatLayout.children)
        print PopupFloatLayout.height
        print ButtonKasse.height
        print HoeheUebrig
        
        # create a default grid layout with custom width/height
        ScrollviewGridLayout = GridLayout(cols=1,size_hint=(1, None), spacing = 10)

        # when we add children to the grid layout, its size doesn't change at
        # all. we need to ensure that the height will be the minimum required to
        # contain all the childs. (otherwise, we'll child outside the bounding
        # box of the childs)
        ScrollviewGridLayout.bind(minimum_height=ScrollviewGridLayout.setter('height'))

        # add button into that grid
        for i in range(30):
            ScrollViewBoxLayout = BoxLayout(size_hint = [1, None],  size_y=50)
            
            button1 = Button(text='button1')
            button2 = Button(text='button2')
            ButtonBoxLayout = BoxLayout(orientation='vertical')
            button3_1 = Button(text='+')
            button3_2 = Button(text='-')
            ButtonBoxLayout.add_widget(button3_1)
            ButtonBoxLayout.add_widget(button3_2)
            
            button4 = Button(text='button4')
            ScrollViewBoxLayout.add_widget(button1)
            ScrollViewBoxLayout.add_widget(button2)
            ScrollViewBoxLayout.add_widget(ButtonBoxLayout)
            ScrollViewBoxLayout.add_widget(button4)
##            btn = Button(text=str(i), size=(480, 40),
##                         size_hint=(None, None))
            ScrollviewGridLayout.add_widget(ScrollViewBoxLayout)
            

        # create a scroll view, with a size < size of the grid
        PopupScrollView = ScrollView(size_hint=(1, 1),
                                     pos_hint={'center_x': .5, 'center_y': .5},
                                     do_scroll_x=False,
                                     scroll_timeout = 80)
        
        PopupScrollView.add_widget(ScrollviewGridLayout)

        PopupBoxLayout.add_widget(PopupScrollView)













##        PopupGridLayout = GridLayout(cols = 4)
##        PopupBoxLayout.add_widget(PopupGridLayout)
##        button1 = Button(text='button1')
##        button2 = Button(text='button2')
##        button3 = Button(text='button3')
##        button4 = Button(text='button4')
##        PopupGridLayout.add_widget(button1)
##        PopupGridLayout.add_widget(button2)
##        PopupGridLayout.add_widget(button3)
##        PopupGridLayout.add_widget(button4)
        
        PopupFloatLayout.add_widget(ButtonExit)
        
        popup.open()
        


    def abrechnung(self, widget):
        TischNr = widget.id
               
        ScreenmanagerPopup = CustomScreenManager()
        popup = Popup(title='Abrechnung für ' + str(TischNr),
                      content=ScreenmanagerPopup,size_hint=(1, 1) )

        popup.open()
        

    def bestellungaendern(self, widget):
        pass

    def tischbenennen(self, widget):
        TischNr = widget.id
        PopupBox1LayoutTischBennenen = BoxLayout(orientation = 'vertical')
        popup = Popup(title='Tisch Nr. ' + str(TischNr) + 'benennen',
                      content=PopupBox1LayoutTischBennenen,
                      size_hint=(0.75, 0.5))
        EingabeTextfeld = TextInput(text='hier Tischbezeichnung eintragen - Funktion muss noch eingebaut werden')            
        PopupBox1LayoutTischBennenen.add_widget(EingabeTextfeld)
        PopupBoxLayoutTischBenennen = BoxLayout(orientation = 'horizontal', size_hint=(1,1))
        ButtonAbbrechenTischBenennen = Button(text="Abbrechen", size_hint=(0.5, 0.5))
        ButtonAbbrechenTischBenennen.bind(on_press=popup.dismiss)
        ButtonOkTischBenennen = Button(text="OK", size_hint=(0.5, 0.5))
        ButtonOkTischBenennen.bind(on_press=popup.dismiss)
        PopupBox1LayoutTischBennenen.add_widget(PopupBoxLayoutTischBenennen)
        PopupBoxLayoutTischBenennen.add_widget(ButtonAbbrechenTischBenennen)
        PopupBoxLayoutTischBenennen.add_widget(ButtonOkTischBenennen)
        #popup.add_widget
        popup.open()
        
        pass



#### function for exporting Data to file ####################################

    def datenpickeln(self, widget):
        BonListe = self.HauptCarousel2.Texteingabe.text
        '''function to pickle data to make it ready for sending'''
        try:
            with open('bonliste.txt', 'w+b') as BonListeDaten_File:
                pickle.dump(BonListe, BonListeDaten_File)
        except IOError as err:
            print('Dateifehler: ' + str(err))
        except pickle.PickleError as perr:
            print('Pickling Fehler: ' + str(perr))

	#### function for importing Data to file ####################################

    def datenentpickeln(self, widget):
        with open('bonliste.txt', 'rb') as BonListeDaten_File_entpickelt:
            BonListeWiederhergestellt = pickle.load(BonListeDaten_File_entpickelt)

        print 'die entpickelte BinListe ist: '
        print BonListeWiederhergestellt
        BonListe = BonListeWiederhergestellt
        self.HauptCarousel3.Textausgabe.text = BonListe
Esempio n. 60
0
 def build(self):
     carousel = Carousel(direction='right')
     for src in k.filenames:
         image = Factory.AsyncImage(source=src, allow_stretch=True)
         carousel.add_widget(image)
     return carousel