def _PopulateCenterButtons(self): # probably better to just launch a dialog with this stuff as proper panels, yeah # I'll be making those panels for the custom dialog anyway # cog icon to control # file delete on better # rating merging on better (d NO) (these are mutually exclusive, so add a radio menu type or whatever) # rating moving on better (d YES) # rating merging on same (d YES) # tag merging on better (d NO) (these are mutually exclusive, so add a radio menu type or whatever) # tag moving on better (d YES) # tag merging on same (d YES) menu_items = [] menu_items.append( ('normal', 'edit tag/ratings merge options and whether to delete bad files', 'help compute.', self._Archive)) menu_items.append( ('normal', 'edit shortcuts', 'help compute.', self._Archive)) cog_button = ClientGUICommon.MenuBitmapButton(self, CC.GlobalBMPs.cog, menu_items) self._top_hbox.AddF(cog_button, CC.FLAGS_SIZER_VCENTER) FullscreenHoverFrameTop._PopulateCenterButtons(self)
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 )
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 )
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 )
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)