Пример #1
0
    def preproc_popup(self):
        preproc_popup = ModalView(size_hint=(None, 1),
                                       width=Window.height)
        preproc_popup.background_color = (0, 0, 0, 0)
        preproc_popup.background = "images/circle_white_shadow.png"

        content = FloatLayout()

        button = Button(text="close", size_hint=(None, None),
                        size=(100, 50),
                        pos_hint={'center_x':.5,
                        'center_y':.25})
        content.add_widget(button)
        preproc_popup.add_widget(content)
        button.bind(on_press=preproc_popup.dismiss)

        # preproc_popup.background = "atlas://data/images/defaulttheme/background-transparent"
        # preproc_popup.border = MaterialWidget(elevation=2)
        preproc_popup.open()
Пример #2
0
    def btnPress(self, *args):
        self.settings.counter += 1
        # всплывает попап с отмазкой
        excuse = self.excuses[randint(0, len(self.excuses) - 1)]
        # textLabel = Label(text=markup_text(size=80, color='000000', text=exсuse, bold=False), markup=True, size_hint=(0.8, 0.8), valign='top')
        # textLabel.bind(size=textLabel.setter('text_size'))
        # popup = ModalView(title="ОТМАЗКА НА СЕГОДНЯ",
        #               title_color=(0x75 / 255.0, 0x86 / 255.0, 0x8F / 255.0, 1),  # 75868F
        #               title_size=46 / divider,
        #               #background='white',
        #               background_color=(1, 1, 1, 0),
        #               separator_color=(1, 1, 1, 1),
        #               content=textLabel,
        #               size_hint=(.7, .5))

        popup = ModalView(size_hint=[0.8, 0.6])
        effectWidget = EffectWidget(size_hint=[1.2, 1.2])
        effectLayout = AnchorLayout(anchor_x='center', anchor_y='center', size_hint=[1, 1])
        popupWidget = RoundedWidget(size_hint=[0.9, 0.9], background_color=(1, 1, 1, 1), shadow_color=(70, 70, 70, 1))
        widgetLayout = BoxLayout(orientation='vertical')

        def popupUpdate(instance, *args):
            x, y = instance.size
            widgetLayout.size = (x - 100, y - 100)
            w, h = instance.pos
            widgetLayout.pos = (w + 50, h + 50)

        popupWidget.bind(size=popupUpdate, pos=popupUpdate)  # popupButton.setter('text_size'))
        captionLabel = Label(text=markup_text(size=46, color='75868F', text='ОТМАЗКА НА СЕГОДНЯ', font='Roboto-Black'), markup=True, size_hint=(1, 0.35), valign='top', halign='left')
        captionLabel.bind(size=captionLabel.setter('text_size'))
        textLabel = Button(text=markup_text(size=80, color='000000', text=excuse, bold=False), markup=True, size_hint=(1, 0.65), valign='top', halign='left', background_color=(0, 0, 0, 0), on_press=popup.dismiss)
        textLabel.bind(size=textLabel.setter('text_size'))
        widgetLayout.add_widget(captionLabel)
        widgetLayout.add_widget(textLabel)
        popupWidget.add_widget(widgetLayout)
        effectLayout.add_widget(popupWidget)
        effectWidget.add_widget(effectLayout)
        effectWidget.effects = [DropShadowEffect(radius=SHADOW_RADIUS / divider, tint=[0, 0, 0, 0.7])]
        popup.add_widget(effectWidget)
        popup.background_color = (0.2, 0.2, 0.2, 0.6)

        popup.open()