Exemplo n.º 1
0
 def __init__(self, **kwargs):
     """
     Initializes the photo application.
     """
     super(Editor, self).__init__(**kwargs)
     self.orientation = 'vertical'
     self._button_dict = {}
     self._image = Image('birds.png')
     # Create top button row
     button_layout = BoxLayout(orientation='horizontal', size_hint=(1, 0.1))
     button_layout.cols = 5
     top_buttons = [
         'Image...', 'Brightness', 'Contrast', 'Warmth', 'Saturation'
     ]
     for button in top_buttons:
         self._button_dict[button] = Button(
             text=button,
             background_normal='',
             background_down='',
             background_color=[.5, .5, .5, 1])
         self._button_dict[button].bind(on_release=self._released)
         button_layout.add_widget(self._button_dict[button])
     self.add_widget(button_layout)
     self._create_dropdown()
     # Create slider row
     slider_layout = BoxLayout(orientation='horizontal', size_hint=(1, 0.1))
     slider_layout.cols = 1
     self._slider = Slider(min=-100, max=100, value=0)
     slider_layout.add_widget(self._slider)
     self.add_widget(slider_layout)
     # Create photo row
     photo_layout = BoxLayout(orientation='horizontal', size_hint=(1, 0.7))
     self._original = Kivy_Image(source=self._image.original_source)
     photo_layout.add_widget(self._original)
     self._edited = Kivy_Image(source=self._image.original_source)
     photo_layout.add_widget(self._edited)
     self.add_widget(photo_layout)
     # Create bottom button row
     button_layout = BoxLayout(orientation='horizontal', size_hint=(1, 0.1))
     button_layout.cols = 5
     bottom_buttons = ['Vignette', 'B&W', 'Invert', 'Solarise', 'Pixelize']
     for button in bottom_buttons:
         self._button_dict[button] = Button(
             text=button,
             background_normal='',
             background_down='',
             background_color=[.5, .5, .5, 1])
         self._button_dict[button].bind(on_release=self._released)
         button_layout.add_widget(self._button_dict[button])
     self.add_widget(button_layout)
     # Declare rest of variables
     self._file_chooser = None
     self._label = None
     self._popup = None
     self._text_input = None
     self._new_pix = None
Exemplo n.º 2
0
    def pudelko_zdjec(lista_sciezek):
        pudelko = BoxLayout(orientation='vertical')
        pudelko.cols = 3
        pudelko.row = 3
        #check_panel = GridLayout(orientation='horizontal')
        cb = CheckBox(active=False)
        #check_panel.add_widget(cb)
        #pudelko.add_widget(check_panel)
        rozmiarlisty = len(lista_sciezek)
        pliki = []
        if lista_sciezek[0] > 0:

            for i in range(lista_sciezek[0]):
                rozmiarlisty = rozmiarlisty - 2
                pliki.append(lista_sciezek[rozmiarlisty])
                print(i)
            for i in range(len(pliki)):
                print('tu jestem')
                plik = Image(source=pliki[i])
                pudelko.add_widget(plik)
        else:
            CMMsFunc.stworz_okno_bledu('Powiadomienie', 'Brak zdjêæ').open()
        return pudelko
Exemplo n.º 3
0
    def popup_content(self,
                      obj,
                      content,
                      index,
                      close_btn_text,
                      popup_size=500):
        # Outer box
        box_popup = BoxLayout(orientation='vertical')
        # Inner box
        inner_box_popup = BoxLayout(orientation='vertical',
                                    size_hint_y=None,
                                    height=0.7 * popup_size)
        inner_box_popup.cols = 4

        # Change title according to sort type
        title = "Results"
        if self.sortedBy == "Location":
            title += " sorted by Location"
        elif self.sortedBy == "Duration":
            title += " sorted by Duration"
        elif self.sortedBy == "Recommendations":
            title += " sorted by Recommendations"

        popup = Popup(title=title,
                      title_align="center",
                      title_color=(0, 0, 0, 1),
                      title_size=28,
                      separator_color=self.popup_sep_color,
                      background='popup_background.jpg',
                      content=box_popup,
                      size_hint_y=None,
                      height=popup_size,
                      size_hint_x=None,
                      width=popup_size)

        # Titles
        titles_box = BoxLayout(orientation='horizontal')
        titles_box.add_widget(Label(text="ID", color=(0, 0, 0, 1), bold=True))
        titles_box.add_widget(
            Label(text="Destination", color=(0, 0, 0, 1), bold=True))
        titles_box.add_widget(
            Label(text="Duration", color=(0, 0, 0, 1), bold=True))
        titles_box.add_widget(
            Label(text="Recommendations", color=(0, 0, 0, 1), bold=True))
        inner_box_popup.add_widget(titles_box)

        # For each result received
        for res in content:
            # Result parameters
            dest = res[0]
            dur = res[1][0]
            rec = res[1][1]
            index += 1

            # Result box
            res_box = BoxLayout(orientation='horizontal', spacing=15)
            res_box.add_widget(Label(text=str(index), color=(0, 0, 0, 1)))
            res_box.add_widget(Label(text=str(dest), color=(0, 0, 0, 1)))
            res_box.add_widget(Label(text=str(dur), color=(0, 0, 0, 1)))
            res_box.add_widget(Label(text=str(rec), color=(0, 0, 0, 1)))
            inner_box_popup.add_widget(res_box)

        # Close button
        close_btn = Button(text=close_btn_text)
        close_btn.bind(on_press=popup.dismiss)
        close_btn.background_color = (15 / 255, 60 / 255, 135 / 255, 1.0)
        close_btn.font_size = 24
        close_btn.bold = True

        box_popup.add_widget(inner_box_popup)
        box_popup.add_widget(close_btn)

        popup.open()