Esempio n. 1
0
    def do_add(self, *args):
        '''Git select files from a list to add
        '''
        d = get_designer()
        if d.popup:
            return False
        files = self.repo.untracked_files
        if not files:
            show_alert('Git Add', 'All files are already indexed by Git')
            return

        # create the popup
        fake_setting = FakeSettingList()
        fake_setting.allow_custom = False
        fake_setting.items = files
        fake_setting.desc = 'Select files to add to Git index'

        content = SettingListContent(setting=fake_setting)
        popup_width = min(0.95 * Window.width, 500)
        popup_height = min(0.95 * Window.height, 500)
        popup = Popup(
            content=content, title='Git - Add files', size_hint=(None, None),
            size=(popup_width, popup_height), auto_dismiss=False)

        content.bind(on_apply=self._perform_do_add,
                     on_cancel=d.close_popup)

        content.show_items()
        d.popup = popup
        popup.open()
Esempio n. 2
0
    def do_branches(self, *args):
        '''Shows a list of git branches and allow to change the current one
        '''
        d = get_designer()
        if d.popup:
            return False
        branches = []
        for b in self.repo.heads:
            branches.append(b.name)

        # create the popup
        fake_setting = FakeSettingList()
        fake_setting.allow_custom = True
        fake_setting.items = branches
        fake_setting.desc = 'Checkout to the selected branch. \n' \
                'You can type a name to create a new branch'
        fake_setting.group = 'git_branch'

        content = SettingListContent(setting=fake_setting)
        popup_width = min(0.95 * Window.width, 500)
        popup_height = min(0.95 * Window.height, 500)
        popup = Popup(
            content=content, title='Git - Branches', size_hint=(None, None),
            size=(popup_width, popup_height), auto_dismiss=False)

        content.bind(on_apply=self._perform_do_branches,
                     on_cancel=d.close_popup)

        content.selected_items = [self.repo.active_branch.name]
        content.show_items()
        d.popup = popup
        popup.open()
Esempio n. 3
0
    def on_widget_select_pressed(self, *args):
        '''Event handler to playground widget selector press
        '''
        widgets = get_current_project().app_widgets
        app_widgets = []
        for name in widgets.keys():
            widget = widgets[name]
            if widget.is_root:
                name = 'Root - ' + name
            app_widgets.append(name)

        fake_setting = FakeSettingList()
        fake_setting.allow_custom = False
        fake_setting.items = app_widgets
        fake_setting.desc = 'Select the Widget to edit on Playground'
        fake_setting.group = 'playground_widget'

        content = SettingListContent(setting=fake_setting)
        popup_width = min(0.95 * Window.width, 500)
        popup_height = min(0.95 * Window.height, 500)
        self._popup = popup = Popup(content=content,
                                    title='Playground - Edit Widget',
                                    size_hint=(None, None),
                                    size=(popup_width, popup_height),
                                    auto_dismiss=False)

        content.bind(on_apply=self._perform_select_root_widget,
                     on_cancel=self._popup.dismiss)

        content.selected_items = [self.root_name]
        if self.root_app_widget and self.root_app_widget.is_root:
            content.selected_items = ['Root - ' + self.root_name]
        content.show_items()

        popup.open()
    def on_touch_down(self, touch):
        '''Display the option chooser
        '''
        if self.collide_point(*touch.pos):
            if self._chooser is None:
                fake_setting = FakeSettingList()
                fake_setting.allow_custom = False
                fake_setting.items = self._options
                fake_setting.desc = 'Property Options'
                fake_setting.group = 'property_options'
                content = SettingListContent(setting=fake_setting)
                self._chooser = content

            self._chooser.parent = None
            self._chooser.selected_items = [self.text]
            self._chooser.show_items()

            popup_width = min(0.95 * Window.width, 500)
            popup_height = min(0.95 * Window.height, 500)
            self._popup = Popup(content=self._chooser,
                                title='Property Options - ' + self.propname,
                                size_hint=(None, None),
                                size=(popup_width, popup_height),
                                auto_dismiss=False)

            self._chooser.bind(on_apply=self._on_options,
                               on_cancel=self._popup.dismiss)

            self._popup.open()
            return True

        return False
    def on_touch_down(self, touch):
        '''Display the option chooser
        '''
        if self.collide_point(*touch.pos):
            if self._chooser is None:
                fake_setting = FakeSettingList()
                fake_setting.allow_custom = False
                fake_setting.items = self._options
                fake_setting.desc = 'Property Options'
                fake_setting.group = 'property_options'
                content = SettingListContent(setting=fake_setting)
                self._chooser = content

            self._chooser.parent = None
            self._chooser.selected_items = [self.text]
            self._chooser.show_items()

            popup_width = min(0.95 * Window.width, 500)
            popup_height = min(0.95 * Window.height, 500)
            self._popup = Popup(
                content=self._chooser,
                title='Property Options - ' + self.propname,
                size_hint=(None, None),
                size=(popup_width, popup_height),
                auto_dismiss=False
            )

            self._chooser.bind(
                    on_apply=self._on_options,
                    on_cancel=self._popup.dismiss)

            self._popup.open()
            return True

        return False
Esempio n. 6
0
    def on_widget_select_pressed(self, *args):
        '''Event handler to playground widget selector press
        '''
        d = get_designer()
        if d.popup:
            return False
        widgets = get_current_project().app_widgets
        app_widgets = []
        for name in widgets.keys():
            widget = widgets[name]
            if widget.is_root:
                name = 'Root - ' + name
            app_widgets.append(name)

        fake_setting = FakeSettingList()
        fake_setting.allow_custom = False
        fake_setting.items = app_widgets
        fake_setting.desc = 'Select the Widget to edit on Playground'
        fake_setting.group = 'playground_widget'

        content = SettingListContent(setting=fake_setting)
        popup_width = min(0.95 * Window.width, 500)
        popup_height = min(0.95 * Window.height, 500)
        d.popup = Popup(
            content=content,
            title='Playground - Edit Widget',
            size_hint=(None, None),
            size=(popup_width, popup_height),
            auto_dismiss=False
        )

        content.bind(on_apply=self._perform_select_root_widget,
                     on_cancel=d.close_popup)

        content.selected_items = [self.root_name]
        if self.root_app_widget and self.root_app_widget.is_root:
            content.selected_items = ['Root - ' + self.root_name]
        content.show_items()

        d.popup.open()
Esempio n. 7
0
    def do_pull(self, *args):
        '''Open a list of remotes to pull remote data.
        If there is not remote, shows an alert
        '''
        d = get_designer()
        if d.popup:
            return False
        if not self.validate_remote():
            show_alert('Git - Remote Authentication',
                       'To use Git remote you need to enter your ssh password')
            return
        remotes = []
        for r in self.repo.remotes:
            remotes.append(r.name)
        if not remotes:
            show_alert('Git Pull Remote', 'There is no git remote configured!')
            return

        # create the popup
        fake_setting = FakeSettingList()
        fake_setting.allow_custom = False
        fake_setting.items = remotes
        fake_setting.desc = 'Pull data from the selected remote'
        fake_setting.group = 'git_remote'

        content = SettingListContent(setting=fake_setting)
        popup_width = min(0.95 * Window.width, 500)
        popup_height = min(0.95 * Window.height, 500)
        popup = popup = Popup(
            content=content, title='Git - Pull Remote', size_hint=(None, None),
            size=(popup_width, popup_height), auto_dismiss=False)

        content.bind(on_apply=self._perform_do_pull,
                     on_cancel=d.close_popup)

        content.selected_items = [remotes[0]]
        content.show_items()
        d.popup = popup
        popup.open()
    def on_widget_select_pressed(self, *args):
        """Event handler to playground widget selector press
        """
        widgets = get_current_project().app_widgets
        app_widgets = []
        for name in widgets.keys():
            widget = widgets[name]
            if widget.is_root:
                name = "Root - " + name
            app_widgets.append(name)

        fake_setting = FakeSettingList()
        fake_setting.allow_custom = False
        fake_setting.items = app_widgets
        fake_setting.desc = "Select the Widget to edit on Playground"
        fake_setting.group = "playground_widget"

        content = SettingListContent(setting=fake_setting)
        popup_width = min(0.95 * Window.width, 500)
        popup_height = min(0.95 * Window.height, 500)
        self._popup = popup = Popup(
            content=content,
            title="Playground - Edit Widget",
            size_hint=(None, None),
            size=(popup_width, popup_height),
            auto_dismiss=False,
        )

        content.bind(on_apply=self._perform_select_root_widget, on_cancel=self._popup.dismiss)

        content.selected_items = [self.root_name]
        if self.root_app_widget and self.root_app_widget.is_root:
            content.selected_items = ["Root - " + self.root_name]
        content.show_items()

        popup.open()