Пример #1
0
    def _ShowMenuIfNeeded(self):

        if self._list_ctrl.HasSelected() > 0:

            menu = wx.Menu()

            ClientGUIMenus.AppendMenuItem(
                self, menu, 'copy sources',
                'Copy all the selected sources to clipboard.',
                self._CopySelectedSeedData)
            ClientGUIMenus.AppendMenuItem(
                self, menu, 'copy notes',
                'Copy all the selected notes to clipboard.',
                self._CopySelectedNotes)

            ClientGUIMenus.AppendSeparator(menu)

            ClientGUIMenus.AppendMenuItem(
                self, menu, 'try again',
                'Reset the progress of all the selected imports.',
                HydrusData.Call(self._SetSelected, CC.STATUS_UNKNOWN))
            ClientGUIMenus.AppendMenuItem(
                self, menu, 'skip', 'Skip all the selected imports.',
                HydrusData.Call(self._SetSelected, CC.STATUS_SKIPPED))
            ClientGUIMenus.AppendMenuItem(self, menu, 'delete',
                                          'Remove all the selected imports.',
                                          self._DeleteSelected)

            HG.client_controller.PopupMenu(self, menu)
Пример #2
0
 def AddDefaultsButton( self, defaults_callable, add_callable ):
     
     import_menu_items = []
     
     all_call = HydrusData.Call( self._AddAllDefaults, defaults_callable, add_callable )
     some_call = HydrusData.Call( self._AddSomeDefaults, defaults_callable, add_callable )
     
     import_menu_items.append( ( 'normal', 'add them all', 'Load all the defaults.', all_call ) )
     import_menu_items.append( ( 'normal', 'select from a list', 'Load some of the defaults.', some_call ) )
     
     self.AddMenuButton( 'add defaults', import_menu_items )
Пример #3
0
    def _GetListCtrlMenu(self):

        selected_file_seeds = self._list_ctrl.GetData(only_selected=True)

        if len(selected_file_seeds) == 0:

            raise HydrusExceptions.DataMissing()

        menu = wx.Menu()

        can_show_files_in_new_page = True in (
            file_seed.HasHash() for file_seed in selected_file_seeds)

        if can_show_files_in_new_page:

            ClientGUIMenus.AppendMenuItem(
                self, menu, 'open selected import files in a new page',
                'Show all the known selected files in a new thumbnail page. This is complicated, so cannot always be guaranteed, even if the import says \'success\'.',
                self._ShowSelectionInNewPage)

            ClientGUIMenus.AppendSeparator(menu)

        ClientGUIMenus.AppendMenuItem(
            self, menu, 'copy sources',
            'Copy all the selected sources to clipboard.',
            self._CopySelectedFileSeedData)
        ClientGUIMenus.AppendMenuItem(
            self, menu, 'copy notes',
            'Copy all the selected notes to clipboard.',
            self._CopySelectedNotes)

        ClientGUIMenus.AppendSeparator(menu)

        ClientGUIMenus.AppendMenuItem(
            self, menu, 'open sources',
            'Open all the selected sources in your file explorer or web browser.',
            self._OpenSelectedFileSeedData)

        ClientGUIMenus.AppendSeparator(menu)

        ClientGUIMenus.AppendMenuItem(
            self, menu, 'try again',
            'Reset the progress of all the selected imports.',
            HydrusData.Call(self._SetSelected, CC.STATUS_UNKNOWN))
        ClientGUIMenus.AppendMenuItem(
            self, menu, 'skip', 'Skip all the selected imports.',
            HydrusData.Call(self._SetSelected, CC.STATUS_SKIPPED))
        ClientGUIMenus.AppendMenuItem(self, menu, 'delete from list',
                                      'Remove all the selected imports.',
                                      self._DeleteSelected)

        return menu
Пример #4
0
    def _GetListCtrlMenu(self):

        selected_gallery_seeds = self._list_ctrl.GetData(only_selected=True)

        if len(selected_gallery_seeds) == 0:

            raise HydrusExceptions.DataMissing()

        menu = wx.Menu()

        ClientGUIMenus.AppendMenuItem(
            self, menu, 'copy urls',
            'Copy all the selected urls to clipboard.',
            self._CopySelectedGalleryURLs)
        ClientGUIMenus.AppendMenuItem(
            self, menu, 'copy notes',
            'Copy all the selected notes to clipboard.',
            self._CopySelectedNotes)

        ClientGUIMenus.AppendSeparator(menu)

        ClientGUIMenus.AppendMenuItem(
            self, menu, 'open urls',
            'Open all the selected urls in your web browser.',
            self._OpenSelectedGalleryURLs)

        ClientGUIMenus.AppendSeparator(menu)

        if not self._read_only:

            ClientGUIMenus.AppendMenuItem(
                self, menu, 'try again (just this one page)',
                'Schedule this url to occur again.',
                HydrusData.Call(self._TrySelectedAgain, False))

            if self._can_generate_more_pages:

                ClientGUIMenus.AppendMenuItem(
                    self, menu, 'try again (and allow search to continue)',
                    'Schedule this url to occur again and continue.',
                    HydrusData.Call(self._TrySelectedAgain, True))

        ClientGUIMenus.AppendMenuItem(
            self, menu, 'skip', 'Skip all the selected urls.',
            HydrusData.Call(self._SetSelected, CC.STATUS_SKIPPED))

        return menu
Пример #5
0
 def CallRepeatingWXSafe( self, window, period, delay, func, *args, **kwargs ):
     
     call = HydrusData.Call( func, *args, **kwargs )
     
     job = ClientThreading.WXAwareRepeatingJob( self, self._job_scheduler, window, call, period, initial_delay = delay )
     
     self._job_scheduler.AddJob( job )
     
     return job
Пример #6
0
 def CallLater( self, delay, func, *args, **kwargs ):
     
     call = HydrusData.Call( func, *args, **kwargs )
     
     job = HydrusThreading.SchedulableJob( self, self._job_scheduler, call, initial_delay = delay )
     
     self._job_scheduler.AddJob( job )
     
     return job
Пример #7
0
 def CallRepeating( self, initial_delay, period, func, *args, **kwargs ):
     
     job_scheduler = self._GetAppropriateJobScheduler( period )
     
     call = HydrusData.Call( func, *args, **kwargs )
     
     job = HydrusThreading.RepeatingJob( self, job_scheduler, initial_delay, period, call )
     
     job_scheduler.AddJob( job )
     
     return job
Пример #8
0
 def CallLater( self, initial_delay, func, *args, **kwargs ):
     
     job_scheduler = self._GetAppropriateJobScheduler( initial_delay )
     
     call = HydrusData.Call( func, *args, **kwargs )
     
     job = HydrusThreading.SchedulableJob( self, job_scheduler, initial_delay, call )
     
     job_scheduler.AddJob( job )
     
     return job
Пример #9
0
    def CallLaterWXSafe(self, window, initial_delay, func, *args, **kwargs):

        job_scheduler = self._GetAppropriateJobScheduler(initial_delay)

        call = HydrusData.Call(func, *args, **kwargs)

        job = ClientThreading.WXAwareJob(self, job_scheduler, window,
                                         initial_delay, call)

        job_scheduler.AddJob(job)

        return job
Пример #10
0
    def _ShowMenuIfNeeded(self):

        selected_gallery_seeds = self._list_ctrl.GetData(only_selected=True)

        if len(selected_gallery_seeds) > 0:

            menu = wx.Menu()

            ClientGUIMenus.AppendMenuItem(
                self, menu, 'copy urls',
                'Copy all the selected urls to clipboard.',
                self._CopySelectedGalleryURLs)
            ClientGUIMenus.AppendMenuItem(
                self, menu, 'copy notes',
                'Copy all the selected notes to clipboard.',
                self._CopySelectedNotes)

            ClientGUIMenus.AppendSeparator(menu)

            ClientGUIMenus.AppendMenuItem(
                self, menu, 'open urls',
                'Open all the selected urls in your web browser.',
                self._OpenSelectedGalleryURLs)

            if not self._read_only:

                ClientGUIMenus.AppendSeparator(menu)

                ClientGUIMenus.AppendMenuItem(
                    self, menu, 'try again',
                    'Reset the progress of all the selected urls.',
                    HydrusData.Call(self._SetSelected, CC.STATUS_UNKNOWN))
                ClientGUIMenus.AppendMenuItem(
                    self, menu, 'skip', 'Skip all the selected urls.',
                    HydrusData.Call(self._SetSelected, CC.STATUS_SKIPPED))
                ClientGUIMenus.AppendMenuItem(self, menu, 'delete from list',
                                              'Remove all the selected urls.',
                                              self._DeleteSelected)

            HG.client_controller.PopupMenu(self, menu)
Пример #11
0
    def CallRepeating(self, period, delay, func, *args, **kwargs):

        call = HydrusData.Call(func, *args, **kwargs)

        job = HydrusThreading.RepeatingJob(self,
                                           self._job_scheduler,
                                           call,
                                           period,
                                           initial_delay=delay)

        self._job_scheduler.AddJob(job)

        return job
Пример #12
0
def CallLater(window, seconds, callable, *args, **kwargs):

    if HG.callto_report_mode:

        what_to_report = [callable]

        if len(args) > 0:

            what_to_report.append(args)

        if len(kwargs) > 0:

            what_to_report.append(kwargs)

        HydrusData.ShowText(tuple(what_to_report))

    call = HydrusData.Call(callable, *args, **kwargs)

    timer = WXAwareTimer(window, call)

    timer.CallLater(seconds)

    return timer
Пример #13
0
    def _PopulateCenterButtons(self):

        menu_items = []

        menu_items.append(
            ('normal', 'edit duplicate action options for \'this is better\'',
             'edit what content is merged when you filter files',
             HydrusData.Call(self._EditMergeOptions, HC.DUPLICATE_BETTER)))
        menu_items.append(
            ('normal', 'edit duplicate action options for \'same quality\'',
             'edit what content is merged when you filter files',
             HydrusData.Call(self._EditMergeOptions,
                             HC.DUPLICATE_SAME_QUALITY)))
        menu_items.append(
            ('normal', 'edit duplicate action options for \'alternates\'',
             'edit what content is merged when you filter files',
             HydrusData.Call(self._EditMergeOptions, HC.DUPLICATE_ALTERNATE)))
        menu_items.append(
            ('normal', 'edit duplicate action options for \'not duplicates\'',
             'edit what content is merged when you filter files',
             HydrusData.Call(self._EditMergeOptions,
                             HC.DUPLICATE_NOT_DUPLICATE)))
        menu_items.append(('separator', None, None, None))
        menu_items.append((
            'normal', 'edit background lighten/darken switch intensity',
            'edit how much the background will brighten or darken as you switch between the pair',
            self._EditBackgroundSwitchIntensity))

        cog_button = ClientGUICommon.MenuBitmapButton(self, CC.GlobalBMPs.cog,
                                                      menu_items)

        self._top_hbox.AddF(cog_button, CC.FLAGS_SIZER_VCENTER)

        FullscreenHoverFrameTopNavigable._PopulateCenterButtons(self)

        dupe_commands = []

        dupe_commands.append((
            'this is better',
            'Set that the current file you are looking at is better than the other in the pair.',
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'duplicate_filter_this_is_better')))
        dupe_commands.append(
            ('same quality',
             'Set that the two files are duplicates of very similar quality.',
             ClientData.ApplicationCommand(
                 CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                 'duplicate_filter_exactly_the_same')))
        dupe_commands.append((
            'alternates',
            'Set that the files are not duplicates, but that one is derived from the other or that they are both descendants of a common ancestor.',
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'duplicate_filter_alternates')))
        dupe_commands.append((
            'not duplicates',
            'Set that the files are not duplicates or otherwise related--that this pair is a false-positive match.',
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'duplicate_filter_not_dupes')))
        dupe_commands.append((
            'custom action',
            'Choose one of the other actions but customise the merge and delete options for this specific decision.',
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'duplicate_filter_custom_action')))

        for (label, tooltip, command) in dupe_commands:

            command_button = ClientGUICommon.BetterButton(
                self, label, HG.client_controller.pub,
                'canvas_application_command', self._canvas_key, command)

            command_button.SetToolTipString(tooltip)

            self._button_hbox.AddF(command_button, CC.FLAGS_VCENTER)
Пример #14
0
    def _PopulateRightButtons(self):

        self._zoom_text = ClientGUICommon.BetterStaticText(self, 'zoom')

        zoom_in = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.zoom_in, HG.client_controller.pub,
            'canvas_application_command', self._canvas_key,
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'zoom_in'))
        zoom_in.SetToolTipString('zoom in')

        zoom_out = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.zoom_out, HG.client_controller.pub,
            'canvas_application_command', self._canvas_key,
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'zoom_out'))
        zoom_out.SetToolTipString('zoom out')

        zoom_switch = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.zoom_switch, HG.client_controller.pub,
            'canvas_application_command', self._canvas_key,
            ClientData.ApplicationCommand(
                CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                'switch_between_100_percent_and_canvas_zoom'))
        zoom_switch.SetToolTipString('zoom switch')

        menu_items = []

        menu_items.append((
            'normal', 'edit shortcuts',
            'edit your sets of shortcuts, and change what shortcuts are currently active on this media viewer',
            self._ManageShortcuts))
        menu_items.append(
            ('normal', 'set current shortcuts',
             'change which custom shortcuts are active on this media viewers',
             HydrusData.Call(HG.client_controller.pub,
                             'edit_media_viewer_custom_shortcuts',
                             self._canvas_key)))
        menu_items.append((
            'normal', 'set default shortcuts',
            'change which custom shortcuts are typically active on new media viewers',
            self._SetDefaultShortcuts))

        shortcuts = ClientGUICommon.MenuBitmapButton(self,
                                                     CC.GlobalBMPs.keyboard,
                                                     menu_items)
        shortcuts.SetToolTipString('shortcuts')

        fullscreen_switch = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.fullscreen_switch, HG.client_controller.pub,
            'canvas_fullscreen_switch', self._canvas_key)
        fullscreen_switch.SetToolTipString('fullscreen switch')

        open_externally = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.open_externally, HG.client_controller.pub,
            'canvas_application_command', self._canvas_key,
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'open_file_in_external_program'))
        open_externally.SetToolTipString('open externally')

        close = ClientGUICommon.BetterButton(self, 'X',
                                             HG.client_controller.pub,
                                             'canvas_close', self._canvas_key)
        close.SetToolTipString('close')

        self._top_hbox.AddF(self._zoom_text, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(zoom_in, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(zoom_out, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(zoom_switch, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(shortcuts, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(fullscreen_switch, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(open_externally, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(close, CC.FLAGS_VCENTER)