Esempio n. 1
0
 def __init__( self, parent, bandwidth_rules ):
     
     ClientGUICommon.StaticBox.__init__( self, parent, 'bandwidth rules' )
     
     columns = [ ( 'type', -1 ), ( 'time delta', 120 ), ( 'max allowed', 80 ) ]
     
     self._listctrl = ClientGUICommon.SaneListCtrl( self, 100, columns, delete_key_callback = self._Delete, activation_callback = self._Edit )
     
     self._add_button = ClientGUICommon.BetterButton( self, 'add', self._Add )
     self._edit_button = ClientGUICommon.BetterButton( self, 'edit', self._Edit )
     self._delete_button = ClientGUICommon.BetterButton( self, 'delete', self._Delete )
     
     #
     
     for rule in bandwidth_rules.GetRules():
         
         sort_tuple = rule
         
         display_tuple = self._GetDisplayTuple( sort_tuple )
         
         self._listctrl.Append( display_tuple, sort_tuple )
         
     
     #
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.AddF( self._add_button, CC.FLAGS_LONE_BUTTON )
     hbox.AddF( self._edit_button, CC.FLAGS_LONE_BUTTON )
     hbox.AddF( self._delete_button, CC.FLAGS_LONE_BUTTON )
     
     self.AddF( self._listctrl, CC.FLAGS_EXPAND_PERPENDICULAR )
     self.AddF( hbox, CC.FLAGS_BUTTON_SIZER )
Esempio n. 2
0
 def __init__( self, parent, initial_dict ):
     
     wx.Panel.__init__( self, parent )
     
     self._listctrl = ClientGUICommon.SaneListCtrl( self, 120, [ ( 'key', 200 ), ( 'value', -1 ) ], delete_key_callback = self.Delete, activation_callback = self.Edit )
     
     self._add = ClientGUICommon.BetterButton( self, 'add', self.Add )
     self._edit = ClientGUICommon.BetterButton( self, 'edit', self.Edit )
     self._delete = ClientGUICommon.BetterButton( self, 'delete', self.Delete )
     
     #
     
     for display_tuple in initial_dict.items():
         
         self._listctrl.Append( display_tuple, display_tuple )
         
     
     #
     
     button_hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     button_hbox.AddF( self._add, CC.FLAGS_VCENTER )
     button_hbox.AddF( self._edit, CC.FLAGS_VCENTER )
     button_hbox.AddF( self._delete, CC.FLAGS_VCENTER )
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.AddF( self._listctrl, CC.FLAGS_EXPAND_BOTH_WAYS )
     vbox.AddF( button_hbox, CC.FLAGS_BUTTON_SIZER )
     
     self.SetSizer( vbox )
Esempio n. 3
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.Add( 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', command, self._canvas_key )
         
         command_button.SetToolTip( tooltip )
         
         self._button_hbox.Add( command_button, CC.FLAGS_VCENTER )
Esempio n. 4
0
    def __init__(self, parent, payload_objs):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_objs = payload_objs

        self._directory_picker = wx.DirPickerCtrl(self)
        self._directory_picker.Bind(wx.EVT_DIRPICKER_CHANGED,
                                    self.EventChanged)

        self._width = wx.SpinCtrl(self, min=100, max=4096)

        self._export = ClientGUICommon.BetterButton(self, 'export',
                                                    self.Export)

        #

        self._width.SetValue(512)

        self._Update()

        #

        rows = []

        rows.append(('export path: ', self._directory_picker))
        rows.append(('png width: ', self._width))
        rows.append(('', self._export))

        gridbox = ClientGUICommon.WrapInGrid(self, rows)

        self.SetSizer(gridbox)
Esempio n. 5
0
 def AddButton( self, label, clicked_func, enabled_only_on_selection = False, enabled_check_func = None ):
     
     button = ClientGUICommon.BetterButton( self, label, clicked_func )
     
     self._AddButton( button, enabled_only_on_selection = enabled_only_on_selection, enabled_check_func = enabled_check_func )
     
     self._UpdateButtons()
Esempio n. 6
0
        def __init__(self, parent, service):

            ClientGUICommon.StaticBox.__init__(self, parent,
                                               'serverside hydrus account')

            self._service = service

            self._my_updater = ClientGUICommon.ThreadToGUIUpdater(
                self, self._Refresh)

            self._title_and_expires_st = wx.StaticText(self)
            self._status_st = wx.StaticText(self)
            self._next_sync_st = wx.StaticText(self)
            self._bandwidth_summary = wx.StaticText(self)
            self._bandwidth_panel = wx.Panel(self)

            self._refresh_account_button = ClientGUICommon.BetterButton(
                self, 'refresh account', self._RefreshAccount)
            self._copy_account_key_button = ClientGUICommon.BetterButton(
                self, 'copy account key', self._CopyAccountKey)
            self._permissions_button = ClientGUICommon.MenuButton(
                self, 'see special permissions', [])

            #

            self._Refresh()

            #

            hbox = wx.BoxSizer(wx.HORIZONTAL)

            hbox.AddF(self._refresh_account_button, CC.FLAGS_LONE_BUTTON)
            hbox.AddF(self._copy_account_key_button, CC.FLAGS_LONE_BUTTON)
            hbox.AddF(self._permissions_button, CC.FLAGS_LONE_BUTTON)

            self.AddF(self._title_and_expires_st,
                      CC.FLAGS_EXPAND_PERPENDICULAR)
            self.AddF(self._status_st, CC.FLAGS_EXPAND_PERPENDICULAR)
            self.AddF(self._next_sync_st, CC.FLAGS_EXPAND_PERPENDICULAR)
            self.AddF(self._bandwidth_summary, CC.FLAGS_EXPAND_PERPENDICULAR)
            self.AddF(self._bandwidth_panel,
                      CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
            self.AddF(hbox, CC.FLAGS_BUTTON_SIZER)

            HydrusGlobals.client_controller.sub(self, 'Update',
                                                'service_updated')
Esempio n. 7
0
        def __init__(self, parent, service):

            ClientGUICommon.StaticBox.__init__(self, parent, 'repository sync')

            self._service = service

            self._my_updater = ClientGUICommon.ThreadToGUIUpdater(
                self, self._Refresh)

            self._content_panel = wx.Panel(self)

            self._metadata_st = wx.StaticText(self)

            self._download_progress = ClientGUICommon.TextAndGauge(self)
            self._processing_progress = ClientGUICommon.TextAndGauge(self)

            self._sync_now_button = ClientGUICommon.BetterButton(
                self, 'process now', self._SyncNow)
            self._pause_play_button = ClientGUICommon.BetterButton(
                self, 'pause', self._PausePlay)
            self._export_updates_button = ClientGUICommon.BetterButton(
                self, 'export updates', self._ExportUpdates)
            self._reset_button = ClientGUICommon.BetterButton(
                self, 'reset processing cache', self._Reset)

            #

            self._Refresh()

            #

            hbox = wx.BoxSizer(wx.HORIZONTAL)

            hbox.AddF(self._sync_now_button, CC.FLAGS_LONE_BUTTON)
            hbox.AddF(self._pause_play_button, CC.FLAGS_LONE_BUTTON)
            hbox.AddF(self._export_updates_button, CC.FLAGS_LONE_BUTTON)
            hbox.AddF(self._reset_button, CC.FLAGS_LONE_BUTTON)

            self.AddF(self._metadata_st, CC.FLAGS_EXPAND_PERPENDICULAR)
            self.AddF(self._download_progress, CC.FLAGS_EXPAND_PERPENDICULAR)
            self.AddF(self._processing_progress, CC.FLAGS_EXPAND_PERPENDICULAR)
            self.AddF(hbox, CC.FLAGS_BUTTON_SIZER)

            HydrusGlobals.client_controller.sub(self, 'Update',
                                                'service_updated')
Esempio n. 8
0
    def __init__(self, parent, payload_obj):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_obj = payload_obj

        self._filepicker = wx.FilePickerCtrl(self,
                                             style=wx.FLP_SAVE,
                                             wildcard='PNG (*.png)|*.png')
        self._filepicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.EventChanged)

        self._title = wx.TextCtrl(self)
        self._title.Bind(wx.EVT_TEXT, self.EventChanged)

        self._payload_description = wx.TextCtrl(self)

        self._text = wx.TextCtrl(self)

        self._width = wx.SpinCtrl(self, min=100, max=4096)

        self._export = ClientGUICommon.BetterButton(self, 'export',
                                                    self.Export)

        #

        (payload_description,
         payload_string) = ClientSerialisable.GetPayloadDescriptionAndString(
             self._payload_obj)

        self._payload_description.SetValue(payload_description)

        self._payload_description.Disable()

        self._width.SetValue(512)

        if isinstance(self._payload_obj,
                      HydrusSerialisable.SerialisableBaseNamed):

            self._title.SetValue(self._payload_obj.GetName())

        self._Update()

        #

        rows = []

        rows.append(('export path: ', self._filepicker))
        rows.append(('title: ', self._title))
        rows.append(('payload description: ', self._payload_description))
        rows.append(('your description (optional): ', self._text))
        rows.append(('png width: ', self._width))
        rows.append(('', self._export))

        gridbox = ClientGUICommon.WrapInGrid(self, rows)

        self.SetSizer(gridbox)
Esempio n. 9
0
 def __init__( self, parent, service_key, media, activate_callable, canvas_key = None ):
     
     wx.Panel.__init__( self, parent )
     
     self._service_key = service_key
     self._media = media
     self._canvas_key = canvas_key
     
     self._script_choice = ClientGUICommon.BetterChoice( self )
     
     self._script_choice.Disable()
     
     self._fetch_button = ClientGUICommon.BetterButton( self, 'fetch tags', self.FetchTags )
     
     self._fetch_button.Disable()
     
     self._script_management = ClientGUIParsing.ScriptManagementControl( self )
     
     self._tags = ListBoxTagsSuggestionsFavourites( self, activate_callable, sort_tags = True )
     
     self._add_all = ClientGUICommon.BetterButton( self, 'add all', self._tags.ActivateAll )
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.Add( self._script_choice, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._fetch_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._script_management, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._add_all, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._tags, CC.FLAGS_EXPAND_BOTH_WAYS )
     
     self._SetTags( [] )
     
     self.SetSizer( vbox )
     
     if self._canvas_key is not None:
         
         HG.client_controller.sub( self, 'CanvasHasNewMedia', 'canvas_new_display_media' )
         
     
     self._FetchScripts()
Esempio n. 10
0
    def __init__(self, parent, file_service_key, tag_service_key):

        self._file_service_key = file_service_key
        self._tag_service_key = tag_service_key

        AutoCompleteDropdown.__init__(self, parent)

        self._current_matches = []

        file_service = HG.client_controller.services_manager.GetService(
            self._file_service_key)

        tag_service = HG.client_controller.services_manager.GetService(
            self._tag_service_key)

        self._file_repo_button = ClientGUICommon.BetterButton(
            self._dropdown_window, file_service.GetName(), self.FileButtonHit)
        self._file_repo_button.SetMinSize((20, -1))

        self._tag_repo_button = ClientGUICommon.BetterButton(
            self._dropdown_window, tag_service.GetName(), self.TagButtonHit)
        self._tag_repo_button.SetMinSize((20, -1))
Esempio n. 11
0
 def AddButton( self, label, clicked_func, enabled_only_on_selection = False, enabled_check_func = None ):
     
     button = ClientGUICommon.BetterButton( self, label, clicked_func )
     
     self._buttonbox.Add( button, CC.FLAGS_VCENTER )
     
     if enabled_only_on_selection:
         
         enabled_check_func = self._SomeSelected
         
     
     if enabled_check_func is not None:
         
         self._button_infos.append( ( button, enabled_check_func ) )
Esempio n. 12
0
    def __init__(self, parent, payload_objs):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_objs = payload_objs

        self._directory_picker = wx.DirPickerCtrl(self)

        dp_width = ClientGUICommon.ConvertTextToPixelWidth(
            self._directory_picker, 52)

        self._directory_picker.SetMinSize((dp_width, -1))

        self._width = wx.SpinCtrl(self, min=100, max=4096)

        self._export = ClientGUICommon.BetterButton(self, 'export',
                                                    self.Export)

        #

        last_png_export_dir = HG.client_controller.new_options.GetNoneableString(
            'last_png_export_dir')

        if last_png_export_dir is not None:

            self._directory_picker.SetPath(last_png_export_dir)

        self._width.SetValue(512)

        self._Update()

        #

        rows = []

        rows.append(('export path: ', self._directory_picker))
        rows.append(('png width: ', self._width))
        rows.append(('', self._export))

        gridbox = ClientGUICommon.WrapInGrid(self, rows)

        self.SetSizer(gridbox)

        self._directory_picker.Bind(wx.EVT_DIRPICKER_CHANGED,
                                    self.EventChanged)
Esempio n. 13
0
    def _PopulateRightButtons(self):

        self._zoom_text = wx.StaticText(self, label='zoom')

        zoom_in = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.zoom_in, HydrusGlobals.client_controller.pub,
            'canvas_zoom_in', self._canvas_key)
        zoom_in.SetToolTipString('zoom in')

        zoom_out = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.zoom_out, HydrusGlobals.client_controller.pub,
            'canvas_zoom_out', self._canvas_key)
        zoom_out.SetToolTipString('zoom out')

        zoom_switch = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.zoom_switch,
            HydrusGlobals.client_controller.pub, 'canvas_zoom_switch',
            self._canvas_key)
        zoom_switch.SetToolTipString('zoom switch')

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

        open_externally = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.open_externally,
            HydrusGlobals.client_controller.pub, 'canvas_open_externally',
            self._canvas_key)
        open_externally.SetToolTipString('open externally')

        close = ClientGUICommon.BetterButton(
            self, 'X', HydrusGlobals.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(fullscreen_switch, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(open_externally, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(close, CC.FLAGS_VCENTER)
Esempio n. 14
0
    def __init__(self, parent):

        wx.Panel.__init__(self, parent)

        self._expanded = False
        self._panel = None

        self._vbox = wx.BoxSizer(wx.VERTICAL)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        self._button = ClientGUICommon.BetterButton(self, 'expand',
                                                    self.ExpandCollapse)

        line = wx.StaticLine(self, style=wx.LI_HORIZONTAL)

        hbox.AddF(self._button, CC.FLAGS_VCENTER)
        hbox.AddF(line, CC.FLAGS_EXPAND_DEPTH_ONLY)

        self._vbox.AddF(hbox, CC.FLAGS_EXPAND_PERPENDICULAR)

        self.SetSizer(self._vbox)
Esempio n. 15
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', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'zoom_in' ), self._canvas_key )
     zoom_in.SetToolTip( 'zoom in' )
     
     zoom_out = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.zoom_out, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'zoom_out' ), self._canvas_key )
     zoom_out.SetToolTip( 'zoom out' )
     
     zoom_switch = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.zoom_switch, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'switch_between_100_percent_and_canvas_zoom' ), self._canvas_key )
     zoom_switch.SetToolTip( 'zoom switch' )
     
     shortcuts = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.keyboard, self._ShowShortcutMenu )
     shortcuts.SetToolTip( 'shortcuts' )
     
     fullscreen_switch = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.fullscreen_switch, HG.client_controller.pub, 'canvas_fullscreen_switch', self._canvas_key )
     fullscreen_switch.SetToolTip( 'fullscreen switch' )
     
     open_externally = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.open_externally, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'open_file_in_external_program' ), self._canvas_key )
     open_externally.SetToolTip( 'open externally' )
     
     drag_button = wx.BitmapButton( self, bitmap = CC.GlobalBMPs.drag )
     drag_button.SetToolTip( 'drag from here to export file' )
     drag_button.Bind( wx.EVT_LEFT_DOWN, self.EventDragButton )
     
     close = ClientGUICommon.BetterButton( self, 'X', HG.client_controller.pub, 'canvas_close', self._canvas_key )
     close.SetToolTip( 'close' )
     
     self._top_hbox.Add( self._zoom_text, CC.FLAGS_VCENTER )
     self._top_hbox.Add( zoom_in, CC.FLAGS_VCENTER )
     self._top_hbox.Add( zoom_out, CC.FLAGS_VCENTER )
     self._top_hbox.Add( zoom_switch, CC.FLAGS_VCENTER )
     self._top_hbox.Add( shortcuts, CC.FLAGS_VCENTER )
     self._top_hbox.Add( fullscreen_switch, CC.FLAGS_VCENTER )
     self._top_hbox.Add( open_externally, CC.FLAGS_VCENTER )
     self._top_hbox.Add( drag_button, CC.FLAGS_VCENTER )
     self._top_hbox.Add( close, CC.FLAGS_VCENTER )
Esempio n. 16
0
    def __init__(self,
                 parent,
                 payload_obj,
                 title=None,
                 description=None,
                 payload_description=None):

        ClientGUIScrolledPanels.ReviewPanel.__init__(self, parent)

        self._payload_obj = payload_obj

        self._filepicker = wx.FilePickerCtrl(self,
                                             style=wx.FLP_SAVE
                                             | wx.FLP_USE_TEXTCTRL,
                                             wildcard='PNG (*.png)|*.png')

        flp_width = ClientGUICommon.ConvertTextToPixelWidth(
            self._filepicker, 64)

        self._filepicker.SetMinSize((flp_width, -1))

        self._title = wx.TextCtrl(self)

        self._payload_description = wx.TextCtrl(self)

        self._text = wx.TextCtrl(self)

        self._width = wx.SpinCtrl(self, min=100, max=4096)

        self._export = ClientGUICommon.BetterButton(self, 'export',
                                                    self.Export)

        #

        if payload_description is None:

            (payload_description, payload_string
             ) = ClientSerialisable.GetPayloadDescriptionAndString(
                 self._payload_obj)

        else:

            payload_string = ClientSerialisable.GetPayloadString(
                self._payload_obj)

            payload_description += ' - ' + HydrusData.ConvertIntToBytes(
                len(payload_string))

        self._payload_description.SetValue(payload_description)

        self._payload_description.Disable()

        self._width.SetValue(512)

        last_png_export_dir = HG.client_controller.new_options.GetNoneableString(
            'last_png_export_dir')

        if title is not None:

            name = title

        elif isinstance(self._payload_obj,
                        HydrusSerialisable.SerialisableBaseNamed):

            name = self._payload_obj.GetName()

        else:

            name = payload_description

        self._title.SetValue(name)

        if description is not None:

            self._text.SetValue(description)

        if last_png_export_dir is not None:

            filename = name + '.png'

            filename = HydrusPaths.SanitizeFilename(filename)

            path = os.path.join(last_png_export_dir, filename)

            self._filepicker.SetPath(path)

        self._Update()

        #

        rows = []

        rows.append(('export path: ', self._filepicker))
        rows.append(('title: ', self._title))
        rows.append(('payload description: ', self._payload_description))
        rows.append(('your description (optional): ', self._text))
        rows.append(('png width: ', self._width))
        rows.append(('', self._export))

        gridbox = ClientGUICommon.WrapInGrid(self, rows)

        self.SetSizer(gridbox)

        self._filepicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.EventChanged)
        self._title.Bind(wx.EVT_TEXT, self.EventChanged)
 def __init__( self, parent, subscription ):
     
     subscription = subscription.Duplicate()
     
     ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
     
     self._original_subscription = subscription
     
     #
     
     self._name = wx.TextCtrl( self )
     
     #
     
     self._info_panel = ClientGUICommon.StaticBox( self, 'info' )
     
     self._last_checked_st = wx.StaticText( self._info_panel )
     self._next_check_st = wx.StaticText( self._info_panel )
     self._seed_info_st = wx.StaticText( self._info_panel )
     
     #
     
     self._query_panel = ClientGUICommon.StaticBox( self, 'site and query' )
     
     self._site_type = ClientGUICommon.BetterChoice( self._query_panel )
     
     site_types = []
     site_types.append( HC.SITE_TYPE_BOORU )
     site_types.append( HC.SITE_TYPE_DEVIANT_ART )
     site_types.append( HC.SITE_TYPE_HENTAI_FOUNDRY_ARTIST )
     site_types.append( HC.SITE_TYPE_HENTAI_FOUNDRY_TAGS )
     site_types.append( HC.SITE_TYPE_NEWGROUNDS )
     site_types.append( HC.SITE_TYPE_PIXIV_ARTIST_ID )
     site_types.append( HC.SITE_TYPE_PIXIV_TAG )
     site_types.append( HC.SITE_TYPE_TUMBLR )
     
     for site_type in site_types:
         
         self._site_type.Append( HC.site_type_string_lookup[ site_type ], site_type )
         
     
     self._site_type.Bind( wx.EVT_CHOICE, self.EventSiteChanged )
     
     self._query = wx.TextCtrl( self._query_panel )
     
     self._booru_selector = wx.ListBox( self._query_panel )
     self._booru_selector.Bind( wx.EVT_LISTBOX, self.EventBooruSelected )
     
     self._period = ClientGUICommon.TimeDeltaButton( self._query_panel, min = 3600 * 4, days = True, hours = True )
     self._period.Bind( ClientGUICommon.EVT_TIME_DELTA, self.EventPeriodChanged )
     
     #
     
     self._options_panel = ClientGUICommon.StaticBox( self, 'options' )
     
     menu_items = []
     
     invert_call = self._InvertGetTagsIfURLKnownAndFileRedundant
     value_call = self._GetTagsIfURLKnownAndFileRedundant
     
     check_manager = ClientGUICommon.CheckboxManagerCalls( invert_call, value_call )
     
     menu_items.append( ( 'check', 'get tags even if url is known and file is already in db (this downloader)', 'If this is selected, the client will fetch the tags from a file\'s page even if it has the file and already previously downloaded it from that location.', check_manager ) )
     
     menu_items.append( ( 'separator', 0, 0, 0 ) )
     
     check_manager = ClientGUICommon.CheckboxManagerOptions( 'get_tags_if_url_known_and_file_redundant' )
     
     menu_items.append( ( 'check', 'get tags even if url is known and file is already in db (default)', 'Set the default for this value.', check_manager ) )
     
     cog_button = ClientGUICommon.MenuBitmapButton( self._options_panel, CC.GlobalBMPs.cog, menu_items )
     
     self._initial_file_limit = ClientGUICommon.NoneableSpinCtrl( self._options_panel, '', none_phrase = 'get everything', min = 1, max = 1000000 )
     self._initial_file_limit.SetToolTipString( 'If set, the first sync will add no more than this many files. Otherwise, it will get everything the gallery has.' )
     
     self._periodic_file_limit = ClientGUICommon.NoneableSpinCtrl( self._options_panel, '', none_phrase = 'get everything', min = 1, max = 1000000 )
     self._periodic_file_limit.SetToolTipString( 'If set, normal syncs will add no more than this many files. Otherwise, they will get everything up until they find a file they have seen before.' )
     
     #
     
     self._control_panel = ClientGUICommon.StaticBox( self, 'control' )
     
     self._paused = wx.CheckBox( self._control_panel )
     
     self._seed_cache_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.seed_cache, self._SeedCache )
     self._seed_cache_button.SetToolTipString( 'open detailed url cache status' )
     
     self._retry_failed = ClientGUICommon.BetterButton( self._control_panel, 'retry failed', self.RetryFailed )
     
     self._check_now_button = ClientGUICommon.BetterButton( self._control_panel, 'force check on dialog ok', self.CheckNow )
     
     self._reset_cache_button = ClientGUICommon.BetterButton( self._control_panel, 'reset url cache', self.ResetCache )
     
     #
     
     self._import_tag_options = ClientGUICollapsible.CollapsibleOptionsTags( self )
     
     self._import_file_options = ClientGUICollapsible.CollapsibleOptionsImportFiles( self )
     
     #
     
     ( name, gallery_identifier, gallery_stream_identifiers, query, period, self._get_tags_if_url_known_and_file_redundant, initial_file_limit, periodic_file_limit, paused, import_file_options, import_tag_options, self._last_checked, self._last_error, self._check_now, self._seed_cache ) = subscription.ToTuple()
     
     self._name.SetValue( name )
     
     site_type = gallery_identifier.GetSiteType()
     
     self._site_type.SelectClientData( site_type )
     
     self._PresentForSiteType()
     
     if site_type == HC.SITE_TYPE_BOORU:
         
         booru_name = gallery_identifier.GetAdditionalInfo()
         
         index = self._booru_selector.FindString( booru_name )
         
         if index != wx.NOT_FOUND:
             
             self._booru_selector.Select( index )
             
         
     
     # set gallery_stream_identifiers selection here--some kind of list of checkboxes or whatever
     
     self._query.SetValue( query )
     
     self._period.SetValue( period )
     
     self._initial_file_limit.SetValue( initial_file_limit )
     self._periodic_file_limit.SetValue( periodic_file_limit )
     
     self._paused.SetValue( paused )
     
     self._import_file_options.SetOptions( import_file_options )
     
     self._import_tag_options.SetOptions( import_tag_options )
     
     if self._last_checked == 0:
         
         self._reset_cache_button.Disable()
         
     
     if self._check_now:
         
         self._check_now_button.Disable()
         
     
     self._UpdateCommandButtons()
     self._UpdateLastNextCheck()
     self._UpdateSeedInfo()
     
     #
     
     self._info_panel.AddF( self._last_checked_st, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._info_panel.AddF( self._next_check_st, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._info_panel.AddF( self._seed_info_st, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'search text: ', self._query ) )
     rows.append( ( 'check for new files every: ', self._period ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._query_panel, rows )
     
     self._query_panel.AddF( self._site_type, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._query_panel.AddF( self._booru_selector, CC.FLAGS_EXPAND_PERPENDICULAR )
     self._query_panel.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'on first check, get at most this many files: ', self._initial_file_limit ) )
     rows.append( ( 'on normal checks, get at most this many newer files: ', self._periodic_file_limit ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._options_panel, rows )
     
     self._options_panel.AddF( cog_button, CC.FLAGS_LONE_BUTTON )
     self._options_panel.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     self._control_panel.AddF( self._seed_cache_button, CC.FLAGS_LONE_BUTTON )
     
     rows = []
     
     rows.append( ( 'currently paused: ', self._paused ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._control_panel, rows )
     
     self._control_panel.AddF( gridbox, CC.FLAGS_LONE_BUTTON )
     self._control_panel.AddF( self._retry_failed, CC.FLAGS_LONE_BUTTON )
     self._control_panel.AddF( self._check_now_button, CC.FLAGS_LONE_BUTTON )
     self._control_panel.AddF( self._reset_cache_button, CC.FLAGS_LONE_BUTTON )
     
     #
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.AddF( ClientGUICommon.WrapInText( self._name, self, 'name: ' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.AddF( self._info_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._query_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._options_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._control_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._import_tag_options, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.AddF( self._import_file_options, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     self.SetSizer( vbox )
Esempio n. 18
0
    def __init__(self,
                 parent,
                 service_key,
                 media,
                 activate_callable,
                 canvas_key=None):

        wx.Panel.__init__(self, parent)

        self._service_key = service_key
        self._media = media
        self._canvas_key = canvas_key

        scripts = HydrusGlobals.client_controller.Read(
            'serialisable_named',
            HydrusSerialisable.SERIALISABLE_TYPE_PARSE_ROOT_FILE_LOOKUP)

        script_names_to_scripts = {
            script.GetName(): script
            for script in scripts
        }

        self._script_choice = ClientGUICommon.BetterChoice(self)

        for (name, script) in script_names_to_scripts.items():

            self._script_choice.Append(script.GetName(), script)

        new_options = HydrusGlobals.client_controller.GetNewOptions()

        favourite_file_lookup_script = new_options.GetNoneableString(
            'favourite_file_lookup_script')

        if favourite_file_lookup_script in script_names_to_scripts:

            self._script_choice.SelectClientData(
                script_names_to_scripts[favourite_file_lookup_script])

        else:

            self._script_choice.Select(0)

        fetch_button = ClientGUICommon.BetterButton(self, 'fetch tags',
                                                    self.FetchTags)

        self._script_management = ClientGUIParsing.ScriptManagementControl(
            self)

        self._tags = ListBoxTagsSuggestionsFavourites(self,
                                                      activate_callable,
                                                      sort_tags=True)

        self._add_all = ClientGUICommon.BetterButton(self, 'add all',
                                                     self._tags.ActivateAll)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.AddF(self._script_choice, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(fetch_button, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._script_management, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._add_all, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._tags, CC.FLAGS_EXPAND_BOTH_WAYS)

        self._SetTags([])

        self.SetSizer(vbox)

        if self._canvas_key is not None:

            HydrusGlobals.client_controller.sub(self, 'CanvasHasNewMedia',
                                                'canvas_new_display_media')
Esempio n. 19
0
 def __init__( self, parent, checker_options ):
     
     ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
     
     help_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.help, self._ShowHelp )
     help_button.SetToolTip( 'Show help regarding these checker options.' )
     
     help_hbox = ClientGUICommon.WrapInText( help_button, self, 'help for this panel -->', wx.Colour( 0, 0, 255 ) )
     
     import ClientDefaults
     
     defaults_panel = ClientGUICommon.StaticBox( self, 'reasonable defaults' )
     
     defaults_1 = ClientGUICommon.BetterButton( defaults_panel, 'thread', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'thread' ) )
     defaults_2 = ClientGUICommon.BetterButton( defaults_panel, 'slow thread', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'slow thread' ) )
     defaults_3 = ClientGUICommon.BetterButton( defaults_panel, 'faster tag subscription', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'fast tag subscription' ) )
     defaults_4 = ClientGUICommon.BetterButton( defaults_panel, 'medium tag/artist subscription', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'artist subscription' ) )
     defaults_5 = ClientGUICommon.BetterButton( defaults_panel, 'slower tag subscription', self.SetValue, ClientDefaults.GetDefaultCheckerOptions( 'slow tag subscription' ) )
     
     #
     
     # add statictext or whatever that will update on any updates above to say 'given velocity of blah and last check at blah, next check in 5 mins'
     # or indeed this could just take the file_seed cache and last check of the caller, if there is one
     # this would be more useful to the user, to know 'right, on ok, it'll refresh in 30 mins'
     # this is actually more complicated--it also needs last check time to calc a fresh file velocity based on new death_file_velocity
     
     #
     
     self._death_file_velocity = VelocityCtrl( self, min_time_delta = 60, days = True, hours = True, minutes = True, per_phrase = 'in', unit = 'files' )
     
     self._flat_check_period_checkbox = wx.CheckBox( self )
     
     #
     
     self._reactive_check_panel = ClientGUICommon.StaticBox( self, 'reactive checking' )
     
     self._intended_files_per_check = wx.SpinCtrl( self._reactive_check_panel, min = 1, max = 1000 )
     
     self._never_faster_than = TimeDeltaCtrl( self._reactive_check_panel, min = 30, days = True, hours = True, minutes = True, seconds = True )
     
     self._never_slower_than = TimeDeltaCtrl( self._reactive_check_panel, min = 600, days = True, hours = True, minutes = True )
     
     #
     
     self._static_check_panel = ClientGUICommon.StaticBox( self, 'static checking' )
     
     self._flat_check_period = TimeDeltaCtrl( self._static_check_panel, min = 180, days = True, hours = True, minutes = True )
     
     #
     
     self.SetValue( checker_options )
     
     #
     
     defaults_panel.Add( defaults_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_3, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_4, CC.FLAGS_EXPAND_PERPENDICULAR )
     defaults_panel.Add( defaults_5, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'intended new files per check: ', self._intended_files_per_check ) )
     rows.append( ( 'never check faster than once per: ', self._never_faster_than ) )
     rows.append( ( 'never check slower than once per: ', self._never_slower_than ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._reactive_check_panel, rows )
     
     self._reactive_check_panel.Add( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'check period: ', self._flat_check_period ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self._static_check_panel, rows )
     
     self._static_check_panel.Add( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     
     #
     
     rows = []
     
     rows.append( ( 'stop checking if new files found falls below: ', self._death_file_velocity ) )
     rows.append( ( 'just check at a static, regular interval: ', self._flat_check_period_checkbox ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self, rows )
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     vbox.Add( help_hbox, CC.FLAGS_BUTTON_SIZER )
     vbox.Add( defaults_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.Add( self._reactive_check_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._static_check_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     self.SetSizer( vbox )
     
     #
     
     self._flat_check_period_checkbox.Bind( wx.EVT_CHECKBOX, self.EventFlatPeriodCheck )
Esempio n. 20
0
 def __init__( self, parent, job_key ):
     
     PopupWindow.__init__( self, parent )
     
     self._job_key = job_key
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     self._title = ClientGUICommon.BetterStaticText( self, style = wx.ALIGN_CENTER )
     
     popup_message_character_width = HG.client_controller.new_options.GetInteger( 'popup_message_character_width' )
     
     wrap_width = ClientGUICommon.ConvertTextToPixelWidth( self._title, popup_message_character_width )
     
     if HG.client_controller.new_options.GetBoolean( 'popup_message_force_min_width' ):
         
         self.SetMinClientSize( ( wrap_width, -1 ) )
         
     
     self._title.SetWrapWidth( wrap_width )
     self._title.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._title.Hide()
     
     self._text_1 = ClientGUICommon.BetterStaticText( self )
     self._text_1.SetWrapWidth( wrap_width )
     self._text_1.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_1.Hide()
     
     self._gauge_1 = ClientGUICommon.Gauge( self, size = ( wrap_width, -1 ) )
     self._gauge_1.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._gauge_1.Hide()
     
     self._text_2 = ClientGUICommon.BetterStaticText( self )
     self._text_2.SetWrapWidth( wrap_width )
     self._text_2.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_2.Hide()
     
     self._gauge_2 = ClientGUICommon.Gauge( self, size = ( wrap_width, -1 ) )
     self._gauge_2.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._gauge_2.Hide()
     
     self._text_yes_no = ClientGUICommon.BetterStaticText( self )
     self._text_yes_no.SetWrapWidth( wrap_width )
     self._text_yes_no.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_yes_no.Hide()
     
     self._yes = ClientGUICommon.BetterButton( self, 'yes', self._YesButton )
     self._yes.Hide()
     
     self._no = ClientGUICommon.BetterButton( self, 'no', self._NoButton )
     self._no.Hide()
     
     self._network_job_ctrl = ClientGUIControls.NetworkJobControl( self )
     self._network_job_ctrl.Hide()
     
     self._copy_to_clipboard_button = ClientGUICommon.BetterButton( self, 'copy to clipboard', self.CopyToClipboard )
     self._copy_to_clipboard_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._copy_to_clipboard_button.Hide()
     
     self._show_files_button = ClientGUICommon.BetterButton( self, 'show files', self.ShowFiles )
     self._show_files_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._show_files_button.Hide()
     
     self._show_tb_button = ClientGUICommon.BetterButton( self, 'show traceback', self.ShowTB )
     self._show_tb_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._show_tb_button.Hide()
     
     self._tb_text = ClientGUICommon.BetterStaticText( self )
     self._tb_text.SetWrapWidth( wrap_width )
     self._tb_text.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._tb_text.Hide()
     
     self._copy_tb_button = ClientGUICommon.BetterButton( self, 'copy traceback information', self.CopyTB )
     self._copy_tb_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._copy_tb_button.Hide()
     
     self._pause_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.pause, self.PausePlay )
     self._pause_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._pause_button.Hide()
     
     self._cancel_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.stop, self.Cancel )
     self._cancel_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._cancel_button.Hide()
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( self._pause_button, CC.FLAGS_VCENTER )
     hbox.Add( self._cancel_button, CC.FLAGS_VCENTER )
     
     yes_no_hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     yes_no_hbox.Add( self._yes, CC.FLAGS_VCENTER )
     yes_no_hbox.Add( self._no, CC.FLAGS_VCENTER )
     
     vbox.Add( self._title, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._gauge_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._gauge_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_yes_no, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( yes_no_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.Add( self._network_job_ctrl, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._copy_to_clipboard_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._show_files_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._show_tb_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._tb_text, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._copy_tb_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( hbox, CC.FLAGS_BUTTON_SIZER )
     
     self.SetSizer( vbox )
Esempio n. 21
0
 def __init__( self, parent, job_key ):
     
     PopupWindow.__init__( self, parent )
     
     self._job_key = job_key
     
     vbox = wx.BoxSizer( wx.VERTICAL )
     
     self._title = ClientGUICommon.FitResistantStaticText( self, style = wx.ALIGN_CENTER )
     self._title.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._title.Hide()
     
     self._text_1 = ClientGUICommon.FitResistantStaticText( self )
     self._text_1.Wrap( self.WRAP_WIDTH )
     self._text_1.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_1.Hide()
     
     self._gauge_1 = ClientGUICommon.Gauge( self, size = ( self.WRAP_WIDTH, -1 ) )
     self._gauge_1.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._gauge_1.Hide()
     
     self._text_2 = ClientGUICommon.FitResistantStaticText( self )
     self._text_2.Wrap( self.WRAP_WIDTH )
     self._text_2.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_2.Hide()
     
     self._gauge_2 = ClientGUICommon.Gauge( self, size = ( self.WRAP_WIDTH, -1 ) )
     self._gauge_2.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._gauge_2.Hide()
     
     self._text_yes_no = ClientGUICommon.FitResistantStaticText( self )
     self._text_yes_no.Wrap( self.WRAP_WIDTH )
     self._text_yes_no.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._text_yes_no.Hide()
     
     self._yes = ClientGUICommon.BetterButton( self, 'yes', self._YesButton )
     self._yes.Hide()
     
     self._no = ClientGUICommon.BetterButton( self, 'no', self._NoButton )
     self._no.Hide()
     
     self._network_job_ctrl = ClientGUIControls.NetworkJobControl( self )
     self._network_job_ctrl.Hide()
     
     self._copy_to_clipboard_button = ClientGUICommon.BetterButton( self, 'copy to clipboard', self.CopyToClipboard )
     self._copy_to_clipboard_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._copy_to_clipboard_button.Hide()
     
     self._show_files_button = ClientGUICommon.BetterButton( self, 'show files', self.ShowFiles )
     self._show_files_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._show_files_button.Hide()
     
     self._show_tb_button = ClientGUICommon.BetterButton( self, 'show traceback', self.ShowTB )
     self._show_tb_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._show_tb_button.Hide()
     
     self._tb_text = ClientGUICommon.FitResistantStaticText( self )
     self._tb_text.Wrap( self.WRAP_WIDTH )
     self._tb_text.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._tb_text.Hide()
     
     self._copy_tb_button = ClientGUICommon.BetterButton( self, 'copy traceback information', self.CopyTB )
     self._copy_tb_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._copy_tb_button.Hide()
     
     self._pause_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.pause, self.PausePlay )
     self._pause_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._pause_button.Hide()
     
     self._cancel_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.stop, self.Cancel )
     self._cancel_button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss )
     self._cancel_button.Hide()
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( self._pause_button, CC.FLAGS_VCENTER )
     hbox.Add( self._cancel_button, CC.FLAGS_VCENTER )
     
     yes_no_hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     yes_no_hbox.Add( self._yes, CC.FLAGS_VCENTER )
     yes_no_hbox.Add( self._no, CC.FLAGS_VCENTER )
     
     vbox.Add( self._title, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._gauge_1, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._gauge_2, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._text_yes_no, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( yes_no_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     vbox.Add( self._network_job_ctrl, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._copy_to_clipboard_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._show_files_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._show_tb_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._tb_text, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( self._copy_tb_button, CC.FLAGS_EXPAND_PERPENDICULAR )
     vbox.Add( hbox, CC.FLAGS_BUTTON_SIZER )
     
     self.SetSizer( vbox )
Esempio n. 22
0
    def _InitAdvancedPanel(self):

        advanced_panel = wx.Panel(self._notebook)

        #

        blacklist_panel = ClientGUICommon.StaticBox(advanced_panel,
                                                    'exclude these')

        self._advanced_blacklist = ClientGUIListBoxes.ListBoxTagsCensorship(
            blacklist_panel)

        self._advanced_blacklist_input = ClientGUIControls.TextAndPasteCtrl(
            blacklist_panel,
            self._AdvancedAddBlacklistMultiple,
            allow_empty_input=True)

        add_blacklist_button = ClientGUICommon.BetterButton(
            blacklist_panel, 'add', self._AdvancedAddBlacklist)
        delete_blacklist_button = ClientGUICommon.BetterButton(
            blacklist_panel, 'delete', self._AdvancedDeleteBlacklist)
        blacklist_everything_button = ClientGUICommon.BetterButton(
            blacklist_panel, 'block everything',
            self._AdvancedBlacklistEverything)

        #

        whitelist_panel = ClientGUICommon.StaticBox(advanced_panel,
                                                    'except for these')

        self._advanced_whitelist = ClientGUIListBoxes.ListBoxTagsCensorship(
            whitelist_panel)

        self._advanced_whitelist_input = ClientGUIControls.TextAndPasteCtrl(
            whitelist_panel,
            self._AdvancedAddWhitelistMultiple,
            allow_empty_input=True)

        self._advanced_add_whitelist_button = ClientGUICommon.BetterButton(
            whitelist_panel, 'add', self._AdvancedAddWhitelist)
        delete_whitelist_button = ClientGUICommon.BetterButton(
            whitelist_panel, 'delete', self._AdvancedDeleteWhitelist)

        #

        button_hbox = wx.BoxSizer(wx.HORIZONTAL)

        button_hbox.Add(self._advanced_blacklist_input,
                        CC.FLAGS_EXPAND_BOTH_WAYS)
        button_hbox.Add(add_blacklist_button, CC.FLAGS_VCENTER)
        button_hbox.Add(delete_blacklist_button, CC.FLAGS_VCENTER)
        button_hbox.Add(blacklist_everything_button, CC.FLAGS_VCENTER)

        blacklist_panel.Add(self._advanced_blacklist,
                            CC.FLAGS_EXPAND_BOTH_WAYS)
        blacklist_panel.Add(button_hbox, CC.FLAGS_EXPAND_PERPENDICULAR)

        #

        button_hbox = wx.BoxSizer(wx.HORIZONTAL)

        button_hbox.Add(self._advanced_whitelist_input,
                        CC.FLAGS_EXPAND_BOTH_WAYS)
        button_hbox.Add(self._advanced_add_whitelist_button, CC.FLAGS_VCENTER)
        button_hbox.Add(delete_whitelist_button, CC.FLAGS_VCENTER)

        whitelist_panel.Add(self._advanced_whitelist,
                            CC.FLAGS_EXPAND_BOTH_WAYS)
        whitelist_panel.Add(button_hbox, CC.FLAGS_EXPAND_PERPENDICULAR)

        #

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(blacklist_panel, CC.FLAGS_EXPAND_BOTH_WAYS)
        hbox.Add(whitelist_panel, CC.FLAGS_EXPAND_BOTH_WAYS)

        advanced_panel.SetSizer(hbox)

        return advanced_panel
Esempio n. 23
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)
Esempio n. 24
0
        def __init__(self, parent, service_key, refresh_callable,
                     filename_tagging_options,
                     present_for_accompanying_file_list):

            wx.Panel.__init__(self, parent)

            self._service_key = service_key
            self._refresh_callable = refresh_callable
            self._present_for_accompanying_file_list = present_for_accompanying_file_list

            #

            self._tags_panel = ClientGUICommon.StaticBox(self, 'tags for all')

            self._tags = ClientGUIListBoxes.ListBoxTagsStringsAddRemove(
                self._tags_panel, self._service_key, self.TagsRemoved)

            expand_parents = True

            self._tag_box = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite(
                self._tags_panel, self.EnterTags, expand_parents,
                CC.LOCAL_FILE_SERVICE_KEY, service_key)

            self._tags_paste_button = ClientGUICommon.BetterButton(
                self._tags_panel, 'paste tags', self._PasteTags)

            #

            self._single_tags_panel = ClientGUICommon.StaticBox(
                self, 'tags just for selected files')

            self._paths_to_single_tags = collections.defaultdict(set)

            self._single_tags = ClientGUIListBoxes.ListBoxTagsStringsAddRemove(
                self._single_tags_panel, self._service_key,
                self.SingleTagsRemoved)

            self._single_tags_paste_button = ClientGUICommon.BetterButton(
                self._single_tags_panel, 'paste tags', self._PasteSingleTags)

            expand_parents = True

            self._single_tag_box = ClientGUIACDropdown.AutoCompleteDropdownTagsWrite(
                self._single_tags_panel, self.EnterTagsSingle, expand_parents,
                CC.LOCAL_FILE_SERVICE_KEY, service_key)

            self.SetSelectedPaths([])

            if not self._present_for_accompanying_file_list:

                self._single_tags_panel.Hide()

            #

            self._checkboxes_panel = ClientGUICommon.StaticBox(self, 'misc')

            self._load_from_txt_files_checkbox = wx.CheckBox(
                self._checkboxes_panel,
                label='try to load tags from neighbouring .txt files')

            txt_files_help_button = ClientGUICommon.BetterBitmapButton(
                self._checkboxes_panel, CC.GlobalBMPs.help, self._ShowTXTHelp)
            txt_files_help_button.SetToolTip(
                'Show help regarding importing tags from .txt files.')

            self._filename_namespace = wx.TextCtrl(self._checkboxes_panel)
            self._filename_namespace.SetMinSize((100, -1))

            self._filename_checkbox = wx.CheckBox(
                self._checkboxes_panel, label='add filename? [namespace]')

            self._dir_namespace_1 = wx.TextCtrl(self._checkboxes_panel)
            self._dir_namespace_1.SetMinSize((100, -1))

            self._dir_checkbox_1 = wx.CheckBox(
                self._checkboxes_panel,
                label='add first directory? [namespace]')

            self._dir_namespace_2 = wx.TextCtrl(self._checkboxes_panel)
            self._dir_namespace_2.SetMinSize((100, -1))

            self._dir_checkbox_2 = wx.CheckBox(
                self._checkboxes_panel,
                label='add second directory? [namespace]')

            self._dir_namespace_3 = wx.TextCtrl(self._checkboxes_panel)
            self._dir_namespace_3.SetMinSize((100, -1))

            self._dir_checkbox_3 = wx.CheckBox(
                self._checkboxes_panel,
                label='add third directory? [namespace]')

            #

            (tags_for_all, load_from_neighbouring_txt_files, add_filename,
             add_first_directory, add_second_directory,
             add_third_directory) = filename_tagging_options.SimpleToTuple()

            self._tags.AddTags(tags_for_all)
            self._load_from_txt_files_checkbox.SetValue(
                load_from_neighbouring_txt_files)

            (add_filename_boolean, add_filename_namespace) = add_filename

            self._filename_checkbox.SetValue(add_filename_boolean)
            self._filename_namespace.SetValue(add_filename_namespace)

            (dir_1_boolean, dir_1_namespace) = add_first_directory

            self._dir_checkbox_1.SetValue(dir_1_boolean)
            self._dir_namespace_1.SetValue(dir_1_namespace)

            (dir_2_boolean, dir_2_namespace) = add_second_directory

            self._dir_checkbox_2.SetValue(dir_2_boolean)
            self._dir_namespace_2.SetValue(dir_2_namespace)

            (dir_3_boolean, dir_3_namespace) = add_third_directory

            self._dir_checkbox_3.SetValue(dir_3_boolean)
            self._dir_namespace_3.SetValue(dir_3_namespace)

            #

            self._tags_panel.Add(self._tags, CC.FLAGS_EXPAND_BOTH_WAYS)
            self._tags_panel.Add(self._tag_box, CC.FLAGS_EXPAND_PERPENDICULAR)
            self._tags_panel.Add(self._tags_paste_button,
                                 CC.FLAGS_EXPAND_PERPENDICULAR)

            self._single_tags_panel.Add(self._single_tags,
                                        CC.FLAGS_EXPAND_BOTH_WAYS)
            self._single_tags_panel.Add(self._single_tag_box,
                                        CC.FLAGS_EXPAND_PERPENDICULAR)
            self._single_tags_panel.Add(self._single_tags_paste_button,
                                        CC.FLAGS_EXPAND_PERPENDICULAR)

            txt_hbox = wx.BoxSizer(wx.HORIZONTAL)

            txt_hbox.Add(self._load_from_txt_files_checkbox,
                         CC.FLAGS_EXPAND_BOTH_WAYS)
            txt_hbox.Add(txt_files_help_button, CC.FLAGS_VCENTER)

            filename_hbox = wx.BoxSizer(wx.HORIZONTAL)

            filename_hbox.Add(self._filename_checkbox, CC.FLAGS_VCENTER)
            filename_hbox.Add(self._filename_namespace,
                              CC.FLAGS_EXPAND_BOTH_WAYS)

            dir_hbox_1 = wx.BoxSizer(wx.HORIZONTAL)

            dir_hbox_1.Add(self._dir_checkbox_1, CC.FLAGS_VCENTER)
            dir_hbox_1.Add(self._dir_namespace_1, CC.FLAGS_EXPAND_BOTH_WAYS)

            dir_hbox_2 = wx.BoxSizer(wx.HORIZONTAL)

            dir_hbox_2.Add(self._dir_checkbox_2, CC.FLAGS_VCENTER)
            dir_hbox_2.Add(self._dir_namespace_2, CC.FLAGS_EXPAND_BOTH_WAYS)

            dir_hbox_3 = wx.BoxSizer(wx.HORIZONTAL)

            dir_hbox_3.Add(self._dir_checkbox_3, CC.FLAGS_VCENTER)
            dir_hbox_3.Add(self._dir_namespace_3, CC.FLAGS_EXPAND_BOTH_WAYS)

            self._checkboxes_panel.Add(txt_hbox,
                                       CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
            self._checkboxes_panel.Add(filename_hbox,
                                       CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
            self._checkboxes_panel.Add(dir_hbox_1,
                                       CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
            self._checkboxes_panel.Add(dir_hbox_2,
                                       CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
            self._checkboxes_panel.Add(dir_hbox_3,
                                       CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)

            hbox = wx.BoxSizer(wx.HORIZONTAL)

            hbox.Add(self._tags_panel, CC.FLAGS_EXPAND_BOTH_WAYS)
            hbox.Add(self._single_tags_panel, CC.FLAGS_EXPAND_BOTH_WAYS)
            hbox.Add(self._checkboxes_panel, CC.FLAGS_EXPAND_PERPENDICULAR)

            self.SetSizer(hbox)

            #

            self._load_from_txt_files_checkbox.Bind(wx.EVT_CHECKBOX,
                                                    self.EventRefresh)
            self._filename_namespace.Bind(wx.EVT_TEXT, self.EventRefresh)
            self._filename_checkbox.Bind(wx.EVT_CHECKBOX, self.EventRefresh)
            self._dir_namespace_1.Bind(wx.EVT_TEXT, self.EventRefresh)
            self._dir_checkbox_1.Bind(wx.EVT_CHECKBOX, self.EventRefresh)
            self._dir_namespace_2.Bind(wx.EVT_TEXT, self.EventRefresh)
            self._dir_checkbox_2.Bind(wx.EVT_CHECKBOX, self.EventRefresh)
            self._dir_namespace_3.Bind(wx.EVT_TEXT, self.EventRefresh)
            self._dir_checkbox_3.Bind(wx.EVT_CHECKBOX, self.EventRefresh)
Esempio n. 25
0
    def AddCommand(self, label, func):

        command_button = ClientGUICommon.BetterButton(self, label, func)

        self._button_hbox.AddF(command_button, CC.FLAGS_VCENTER)