示例#1
0
    def _PopulateCenterButtons(self):

        self._archive_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.archive, self._Archive)

        self._trash_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.delete, HydrusGlobals.client_controller.pub,
            'canvas_delete', self._canvas_key)
        self._trash_button.SetToolTipString('send to trash')

        self._delete_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.trash_delete,
            HydrusGlobals.client_controller.pub, 'canvas_delete',
            self._canvas_key)
        self._delete_button.SetToolTipString('delete completely')

        self._undelete_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.undelete, HydrusGlobals.client_controller.pub,
            'canvas_undelete', self._canvas_key)
        self._undelete_button.SetToolTipString('undelete')

        self._top_hbox.AddF(self._archive_button, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._trash_button, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._delete_button, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._undelete_button, CC.FLAGS_VCENTER)
示例#2
0
 def _PopulateLeftButtons( self ):
     
     self._previous_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.previous, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_previous' ), self._canvas_key )
     self._previous_button.SetToolTip( 'previous' )
     
     self._index_text = ClientGUICommon.BetterStaticText( self, 'index' )
     
     self._next_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.next, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_next' ), self._canvas_key )
     self._next_button.SetToolTip( 'next' )
     
     self._top_hbox.Add( self._previous_button, CC.FLAGS_VCENTER )
     self._top_hbox.Add( self._index_text, CC.FLAGS_VCENTER )
     self._top_hbox.Add( self._next_button, CC.FLAGS_VCENTER )
示例#3
0
 def _PopulateLeftButtons( self ):
     
     self._first_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.first, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_first' ), self._canvas_key )
     self._first_button.SetToolTip( 'first' )
     
     self._top_hbox.Add( self._first_button, CC.FLAGS_VCENTER )
     
     FullscreenHoverFrameTopNavigable._PopulateLeftButtons( self )
     
     self._last_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.last, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_last' ), self._canvas_key )
     self._last_button.SetToolTip( 'last' )
     
     self._top_hbox.Add( self._last_button, CC.FLAGS_VCENTER )
示例#4
0
 def _PopulateLeftButtons( self ):
     
     self._back_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.previous, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'archive_delete_filter_back' ), self._canvas_key )
     self._back_button.SetToolTip( 'back' )
     
     self._top_hbox.Add( self._back_button, CC.FLAGS_VCENTER )
     
     FullscreenHoverFrameTop._PopulateLeftButtons( self )
     
     self._skip_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.next, HG.client_controller.pub, 'canvas_application_command', ClientData.ApplicationCommand( CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'archive_delete_filter_skip' ), self._canvas_key )
     self._skip_button.SetToolTip( 'skip' )
     
     self._top_hbox.Add( self._skip_button, CC.FLAGS_VCENTER )
示例#5
0
 def __init__( self, parent ):
     
     wx.Panel.__init__( self, parent, style = wx.BORDER_DOUBLE )
     
     self._network_job = None
     self._download_started = False
     
     self._auto_override_bandwidth_rules = False
     
     self._left_text = ClientGUICommon.BetterStaticText( self, style = wx.ST_ELLIPSIZE_END )
     self._right_text = ClientGUICommon.BetterStaticText( self, style = wx.ALIGN_RIGHT )
     
     self._last_right_min_width = ( -1, -1 )
     
     self._gauge = ClientGUICommon.Gauge( self )
     
     menu_items = []
     
     invert_call = self.FlipOverrideBandwidthForCurrentJob
     value_call = self.CurrentJobOverridesBandwidth
     
     check_manager = ClientGUICommon.CheckboxManagerCalls( invert_call, value_call )
     
     menu_items.append( ( 'check', 'override bandwidth rules for this job', 'Tell the current job to ignore existing bandwidth rules and go ahead anyway.', check_manager ) )
     
     menu_items.append( ( 'separator', 0, 0, 0 ) )
     
     invert_call = self.FlipAutoOverrideBandwidth
     value_call = self.AutoOverrideBandwidth
     
     check_manager = ClientGUICommon.CheckboxManagerCalls( invert_call, value_call )
     
     menu_items.append( ( 'check', 'auto-override bandwidth rules for all jobs here after five seconds', 'Ignore existing bandwidth rules for all jobs under this control, instead waiting a flat five seconds.', check_manager ) )
     
     self._cog_button = ClientGUICommon.MenuBitmapButton( self, CC.GlobalBMPs.cog, menu_items )
     self._cancel_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.stop, self.Cancel )
     
     #
     
     self._Update()
     
     #
     
     st_hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     st_hbox.Add( self._left_text, CC.FLAGS_EXPAND_BOTH_WAYS )
     st_hbox.Add( self._right_text, CC.FLAGS_VCENTER )
     
     left_vbox = wx.BoxSizer( wx.VERTICAL )
     
     left_vbox.Add( st_hbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS )
     left_vbox.Add( self._gauge, CC.FLAGS_EXPAND_PERPENDICULAR )
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( left_vbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS )
     hbox.Add( self._cog_button, CC.FLAGS_VCENTER )
     hbox.Add( self._cancel_button, CC.FLAGS_VCENTER )
     
     self.SetSizer( hbox )
示例#6
0
    def _PopulateLeftButtons(self):

        self._first_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.first, HydrusGlobals.client_controller.pub,
            'canvas_show_first', self._canvas_key)
        self._first_button.SetToolTipString('first')

        self._top_hbox.AddF(self._first_button, CC.FLAGS_VCENTER)

        FullscreenHoverFrameTop._PopulateLeftButtons(self)

        self._last_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.last, HydrusGlobals.client_controller.pub,
            'canvas_show_last', self._canvas_key)
        self._last_button.SetToolTipString('last')

        self._top_hbox.AddF(self._last_button, CC.FLAGS_VCENTER)
示例#7
0
    def _PopulateLeftButtons(self):

        self._previous_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.previous, HydrusGlobals.client_controller.pub,
            'canvas_show_previous', self._canvas_key)
        self._previous_button.SetToolTipString('previous')

        self._index_text = wx.StaticText(self, label='index')

        self._next_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.next, HydrusGlobals.client_controller.pub,
            'canvas_show_next', self._canvas_key)
        self._next_button.SetToolTipString('next')

        self._top_hbox.AddF(self._previous_button, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._index_text, CC.FLAGS_VCENTER)
        self._top_hbox.AddF(self._next_button, CC.FLAGS_VCENTER)
示例#8
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)
示例#9
0
    def _PopulateLeftButtons(self):

        self._first_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.first, HG.client_controller.pub,
            'canvas_application_command', self._canvas_key,
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'duplicate_filter_back'))
        self._first_button.SetToolTipString('go back a pair')

        self._top_hbox.AddF(self._first_button, CC.FLAGS_VCENTER)

        FullscreenHoverFrameTopNavigable._PopulateLeftButtons(self)

        self._last_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.last, HG.client_controller.pub,
            'canvas_application_command', self._canvas_key,
            ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE,
                                          'duplicate_filter_skip'))
        self._last_button.SetToolTipString('show a different pair')

        self._top_hbox.AddF(self._last_button, CC.FLAGS_VCENTER)
示例#10
0
 def __init__( self, parent, add_callable, allow_empty_input = False ):
     
     self._add_callable = add_callable
     self._allow_empty_input = allow_empty_input
     
     wx.Panel.__init__( self, parent )
     
     self._text_input = wx.TextCtrl( self, style = wx.TE_PROCESS_ENTER )
     self._text_input.Bind( wx.EVT_KEY_DOWN, self.EventKeyDown )
     
     self._paste_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.paste, self._Paste )
     self._paste_button.SetToolTip( 'Paste multiple inputs from the clipboard. Assumes the texts are newline-separated.' )
     
     #
     
     hbox = wx.BoxSizer( wx.HORIZONTAL )
     
     hbox.Add( self._text_input, CC.FLAGS_EXPAND_BOTH_WAYS )
     hbox.Add( self._paste_button, CC.FLAGS_VCENTER )
     
     self.SetSizer( hbox )
示例#11
0
    def __init__(self, parent):

        OptionsPanel.__init__(self, parent)

        self._service_keys_to_checkbox_info = {}
        self._service_keys_to_explicit_button_info = {}
        self._button_ids_to_service_keys = {}

        #

        help_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.help, self._ShowHelp)
        help_button.SetToolTipString('Show help regarding these tag options.')

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

        #

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.AddF(help_button, CC.FLAGS_LONE_BUTTON)
        vbox.AddF(self._services_vbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)

        self.SetSizer(vbox)
示例#12
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 )
示例#13
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)
示例#14
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 )
 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 )
示例#16
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 )
示例#17
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)
示例#18
0
    def __init__(self,
                 parent,
                 tag_filter,
                 prefer_blacklist=False,
                 namespaces=None,
                 message=None):

        ClientGUIScrolledPanels.EditPanel.__init__(self, parent)

        self._namespaces = namespaces

        #

        help_button = ClientGUICommon.BetterBitmapButton(
            self, CC.GlobalBMPs.help, self._ShowHelp)

        help_hbox = ClientGUICommon.WrapInText(help_button, self,
                                               'help for this panel -->',
                                               wx.Colour(0, 0, 255))

        #

        self._notebook = wx.Notebook(self)

        #

        self._advanced_panel = self._InitAdvancedPanel()

        self._whitelist_panel = self._InitWhitelistPanel()
        self._blacklist_panel = self._InitBlacklistPanel()

        #

        if prefer_blacklist:

            self._notebook.AddPage(self._blacklist_panel, 'blacklist')
            self._notebook.AddPage(self._whitelist_panel, 'whitelist')

        else:

            self._notebook.AddPage(self._whitelist_panel, 'whitelist')
            self._notebook.AddPage(self._blacklist_panel, 'blacklist')

        self._notebook.AddPage(self._advanced_panel, 'advanced')

        blacklist_tag_slices = [
            tag_slice
            for (tag_slice, rule) in tag_filter.GetTagSlicesToRules().items()
            if rule == CC.FILTER_BLACKLIST
        ]
        whitelist_tag_slices = [
            tag_slice
            for (tag_slice, rule) in tag_filter.GetTagSlicesToRules().items()
            if rule == CC.FILTER_WHITELIST
        ]

        self._advanced_blacklist.AddTags(blacklist_tag_slices)
        self._advanced_whitelist.AddTags(whitelist_tag_slices)

        (whitelist_possible,
         blacklist_possible) = self._GetWhiteBlacklistsPossible()

        selection_tests = []

        if prefer_blacklist:

            selection_tests.append((blacklist_possible, 0))
            selection_tests.append((whitelist_possible, 1))
            selection_tests.append((True, 2))

        else:

            selection_tests.append((whitelist_possible, 0))
            selection_tests.append((blacklist_possible, 1))
            selection_tests.append((True, 2))

        for (test, index) in selection_tests:

            if test:

                self._notebook.SetSelection(index)

                break

        #

        self._redundant_st = ClientGUICommon.BetterStaticText(self, '')

        self._current_filter_st = ClientGUICommon.BetterStaticText(
            self, 'currently keeping: ')

        #

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.Add(help_hbox, CC.FLAGS_BUTTON_SIZER)

        if message is not None:

            vbox.Add(ClientGUICommon.BetterStaticText(self, message),
                     CC.FLAGS_EXPAND_PERPENDICULAR)

        vbox.Add(self._notebook, CC.FLAGS_EXPAND_BOTH_WAYS)
        vbox.Add(self._redundant_st, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.Add(self._current_filter_st, CC.FLAGS_EXPAND_PERPENDICULAR)

        self.SetSizer(vbox)

        #

        self._advanced_panel.Bind(ClientGUIListBoxes.EVT_LIST_BOX,
                                  self.EventListBoxChanged)
        self._simple_whitelist_global_checkboxes.Bind(
            wx.EVT_CHECKLISTBOX, self.EventSimpleWhitelistGlobalCheck)
        self._simple_whitelist_namespace_checkboxes.Bind(
            wx.EVT_CHECKLISTBOX, self.EventSimpleWhitelistNamespaceCheck)
        self._simple_blacklist_global_checkboxes.Bind(
            wx.EVT_CHECKLISTBOX, self.EventSimpleBlacklistGlobalCheck)
        self._simple_blacklist_namespace_checkboxes.Bind(
            wx.EVT_CHECKLISTBOX, self.EventSimpleBlacklistNamespaceCheck)

        self._UpdateStatus()
示例#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))

        # 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 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'

        self._intended_files_per_check = wx.SpinCtrl(self, min=1, max=1000)

        self._never_faster_than = TimeDeltaCtrl(self,
                                                min=30,
                                                days=True,
                                                hours=True,
                                                minutes=True,
                                                seconds=True)

        self._never_slower_than = TimeDeltaCtrl(self,
                                                min=600,
                                                days=True,
                                                hours=True,
                                                minutes=True)

        self._death_file_velocity = VelocityCtrl(self,
                                                 min_time_delta=60,
                                                 days=True,
                                                 hours=True,
                                                 minutes=True,
                                                 per_phrase='in',
                                                 unit='files')

        #

        (intended_files_per_check, never_faster_than, never_slower_than,
         death_file_velocity) = checker_options.ToTuple()

        self._intended_files_per_check.SetValue(intended_files_per_check)
        self._never_faster_than.SetValue(never_faster_than)
        self._never_slower_than.SetValue(never_slower_than)
        self._death_file_velocity.SetValue(death_file_velocity)

        #

        rows = []

        rows.append(
            ('intended new files per check: ', self._intended_files_per_check))
        rows.append(('stop checking if new files found falls below: ',
                     self._death_file_velocity))
        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, rows)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.Add(help_hbox, CC.FLAGS_BUTTON_SIZER)
        vbox.Add(gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)

        self.SetSizer(vbox)
示例#20
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 )