def switch_animations_enabled(self, _, value):
     Config.animations = value
     Notification(
         title_='Restart required',
         message=
         f'A [color={theme.PRIM}]restart[/color] may be required to [color={theme.PRIM}]{"enable" if value else "disable"}[/color] animations.'
     ).open()
Beispiel #2
0
    def update_callback(self, from_selection=False):
        self.goto_page(0)
        self.ids.invert_selection_button.disabled = True
        OverdrawLabel(
            widget=self.ids.quickupdate_content,
            icon='\ue896',
            text='Updating dlls..')

        if from_selection:
            dlls = [
                item.get('text', '')
                for item in self.ids.dll_view.selected_nodes
            ]
            ConfLastDlls.set_list(self.path, dlls)
        else:
            dlls = self.listed_dlls

        Notification(
            title_=f'Updating {len(dlls)} dlls',
            message=
            f'This can take a [color={theme.PRIM}]while[/color] depending on your [color={theme.PRIM}]internet speed[/color].'
        ).open()

        try:
            self.updater.update_dlls(self.path, dlls)

        except Exception:
            ErrorPopup(
                title='Failed to update dlls!',
                message=
                f'Something happened and we are not sure what it was. Please contact our support from the settings.\n\n[color=f55]{format_exc()}[/color]'
            ).open()
            OverdrawLabel(
                widget=self.ids.quickupdate_content,
                icon='\uea39',
                text='Update failed')

        else:
            OverdrawLabel(
                widget=self.ids.quickupdate_content,
                icon='\ue930',
                text='Completed')

            if self.launch_path:
                self.launch_now_btn = LaunchNowButton()
                self.ids.content_updater.add_widget(
                    self.launch_now_btn, index=0)

        self.ids.dll_view.data = []
    def on_theme(self, __, theme_):
        Config.theme = theme_.name
        self.display_colors = list(theme_.get_values_kivy_color().values())

        def on_complete(*args):
            self.ids.label.text = self.theme.decoded_name
            Animation(opacity=1, d=.2, t='out_expo').start(self.ids.label)

        anim = Animation(opacity=0, d=.2, t='in_expo')
        anim.bind(on_complete=on_complete)
        anim.start(self.ids.label)

        if theme_.name != theme.name:
            Notification(
                title_='Restart required',
                message=
                f'Please [color={theme.PRIM}]restart[/color] XtremeUpdater to set the new theme.'
            ).open()
    def export_logs(self):
        OUTPUT = os.path.expanduser('~\\Desktop\\XtremeUpdater_Logs.zip')
        SOURCE = os.path.abspath('logs\\')

        Logger.info(f"Trying to export logs from {SOURCE} to {OUTPUT}")

        try:
            shutil.make_archive(OUTPUT, 'zip', SOURCE)
        except:
            Logger.error(
                f"Failed to export logs from {SOURCE} to {OUTPUT}\n{format_exc()}"
            )
            raise
        else:
            Logger.info(
                f"Successfully exported logs from {SOURCE} to {OUTPUT}")

        Notification(
            title_='Logs exported',
            message=
            f'[color={theme.PRIM}]Logs[/color] were exported to [color={theme.PRIM}]{OUTPUT}[/color]',
            height=160).open()