def __init__(self, parent): PanelPredicateSystem.__init__(self, parent) self._operator = ClientGUICommon.BetterChoice(self) self._operator.Append('has', True) self._operator.Append('does not have', False) self._url_matches = ClientGUICommon.BetterChoice(self) for url_match in HG.client_controller.network_engine.domain_manager.GetURLMatches( ): if url_match.ShouldAssociateWithFiles(): self._url_matches.Append(url_match.GetName(), url_match) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(ClientGUICommon.BetterStaticText(self, 'system:known url'), CC.FLAGS_VCENTER) hbox.Add(self._operator, CC.FLAGS_VCENTER) hbox.Add( ClientGUICommon.BetterStaticText(self, 'url matching this class:'), CC.FLAGS_VCENTER) hbox.Add(self._url_matches, CC.FLAGS_VCENTER) self.SetSizer(hbox)
def __init__(self, parent, initial_value=65536): wx.Panel.__init__(self, parent) self._spin = wx.SpinCtrl(self, min=0, max=1048576) width = ClientGUICommon.ConvertTextToPixelWidth(self._spin, 12) self._spin.SetSize((width, -1)) self._unit = ClientGUICommon.BetterChoice(self) self._unit.Append('B', 1) self._unit.Append('KB', 1024) self._unit.Append('MB', 1024 * 1024) self._unit.Append('GB', 1024 * 1024 * 1024) # self.SetValue(initial_value) # hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self._spin, CC.FLAGS_VCENTER) hbox.Add(self._unit, CC.FLAGS_VCENTER) self.SetSizer(hbox)
def __init__(self, parent, rule): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._bandwidth_type = ClientGUICommon.BetterChoice(self) self._bandwidth_type.Append('data', HC.BANDWIDTH_TYPE_DATA) self._bandwidth_type.Append('requests', HC.BANDWIDTH_TYPE_REQUESTS) self._bandwidth_type.Bind(wx.EVT_CHOICE, self.EventBandwidth) self._max_allowed_bytes = BytesControl(self) self._max_allowed_requests = wx.SpinCtrl(self, min=1, max=1048576) self._time_delta = ClientGUITime.TimeDeltaButton( self, min=1, days=True, hours=True, minutes=True, seconds=True, monthly_allowed=True) # (bandwidth_type, time_delta, max_allowed) = rule self._bandwidth_type.SelectClientData(bandwidth_type) self._time_delta.SetValue(time_delta) if bandwidth_type == HC.BANDWIDTH_TYPE_DATA: self._max_allowed_bytes.SetValue(max_allowed) else: self._max_allowed_requests.SetValue(max_allowed) self._UpdateEnabled() # hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self._max_allowed_bytes, CC.FLAGS_VCENTER) hbox.Add(self._max_allowed_requests, CC.FLAGS_VCENTER) hbox.Add(self._bandwidth_type, CC.FLAGS_VCENTER) hbox.Add(ClientGUICommon.BetterStaticText(self, ' every '), CC.FLAGS_VCENTER) hbox.Add(self._time_delta, CC.FLAGS_VCENTER) self.SetSizer(hbox)
def __init__( self, parent, rule ): ClientGUIScrolledPanels.EditPanel.__init__( self, parent ) self._bandwidth_type = ClientGUICommon.BetterChoice( self ) self._bandwidth_type.Append( 'data', HC.BANDWIDTH_TYPE_DATA ) self._bandwidth_type.Append( 'requests', HC.BANDWIDTH_TYPE_REQUESTS ) self._bandwidth_type.Bind( wx.EVT_CHOICE, self.EventBandwidth ) self._time_delta = ClientGUICommon.TimeDeltaButton( self, min = 3600, days = True, hours = True, monthly_allowed = True ) self._max_allowed = wx.SpinCtrl( self, min = 1, max = 1024 * 1024 * 1024 ) self._max_allowed_st = wx.StaticText( self ) # ( bandwidth_type, time_delta, max_allowed ) = rule self._bandwidth_type.SelectClientData( bandwidth_type ) self._time_delta.SetValue( time_delta ) if bandwidth_type == HC.BANDWIDTH_TYPE_DATA: max_allowed /= 1048576 self._max_allowed.SetValue( max_allowed ) self._UpdateMaxAllowedSt() # hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.AddF( self._bandwidth_type, CC.FLAGS_VCENTER ) hbox.AddF( self._time_delta, CC.FLAGS_VCENTER ) hbox.AddF( self._max_allowed, CC.FLAGS_VCENTER ) hbox.AddF( self._max_allowed_st, CC.FLAGS_VCENTER ) self.SetSizer( hbox )
def __init__( self, parent ): PanelPredicateSystem.__init__( self, parent ) self._operator = ClientGUICommon.BetterChoice( self ) self._operator.Append( 'has', True ) self._operator.Append( 'does not have', False ) self._regex = wx.TextCtrl( self, size = ( 250, -1 ) ) hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:known url' ), CC.FLAGS_VCENTER ) hbox.Add( self._operator, CC.FLAGS_VCENTER ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'a url that matches this regex:' ), CC.FLAGS_VCENTER ) hbox.Add( self._regex, CC.FLAGS_VCENTER ) self.SetSizer( hbox )
def __init__( self, parent ): PanelPredicateSystem.__init__( self, parent ) self._operator = ClientGUICommon.BetterChoice( self ) self._operator.Append( 'has', True ) self._operator.Append( 'does not have', False ) self._domain = wx.TextCtrl( self, size = ( 250, -1 ) ) self._domain.SetValue( 'example.com' ) hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:known url' ), CC.FLAGS_VCENTER ) hbox.Add( self._operator, CC.FLAGS_VCENTER ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'a url with domain:' ), CC.FLAGS_VCENTER ) hbox.Add( self._domain, CC.FLAGS_VCENTER ) self.SetSizer( hbox )
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()
def __init__(self, parent): PanelPredicateSystem.__init__(self, parent) self._hash = wx.TextCtrl(self) self._hash_type = ClientGUICommon.BetterChoice(self) self._hash_type.Append('sha256', 'sha256') self._hash_type.Append('md5', 'md5') self._hash_type.Append('sha1', 'sha1') self._hash_type.Append('sha512', 'sha512') self._hash_type.SetSelection(0) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.AddF(wx.StaticText(self, label='system:hash='), CC.FLAGS_MIXED) hbox.AddF(self._hash, CC.FLAGS_MIXED) hbox.AddF(self._hash_type, CC.FLAGS_MIXED) self.SetSizer(hbox) wx.CallAfter(self._hash.SetFocus)
def __init__(self, parent, export_folder): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._export_folder = export_folder (name, path, export_type, delete_from_client_after_export, file_search_context, period, phrase) = self._export_folder.ToTuple() self._path_box = ClientGUICommon.StaticBox(self, 'name and location') self._name = wx.TextCtrl(self._path_box) self._path = wx.DirPickerCtrl(self._path_box, style=wx.DIRP_USE_TEXTCTRL) # self._type_box = ClientGUICommon.StaticBox(self, 'type of export') self._type = ClientGUICommon.BetterChoice(self._type_box) self._type.Append('regular', HC.EXPORT_FOLDER_TYPE_REGULAR) self._type.Append('synchronise', HC.EXPORT_FOLDER_TYPE_SYNCHRONISE) self._delete_from_client_after_export = wx.CheckBox(self._type_box) # self._query_box = ClientGUICommon.StaticBox(self, 'query to export') self._page_key = 'export folders placeholder' predicates = file_search_context.GetPredicates() self._predicates_box = ClientGUIListBoxes.ListBoxTagsActiveSearchPredicates( self._query_box, self._page_key, predicates) self._searchbox = ClientGUIACDropdown.AutoCompleteDropdownTagsRead( self._query_box, self._page_key, file_search_context) # self._period_box = ClientGUICommon.StaticBox(self, 'export period') self._period = ClientGUITime.TimeDeltaButton(self._period_box, min=3 * 60, days=True, hours=True, minutes=True) # self._phrase_box = ClientGUICommon.StaticBox(self, 'filenames') self._pattern = wx.TextCtrl(self._phrase_box) self._examples = ClientGUICommon.ExportPatternButton(self._phrase_box) # self._name.SetValue(name) self._path.SetPath(path) self._type.SelectClientData(export_type) self._delete_from_client_after_export.SetValue( delete_from_client_after_export) self._period.SetValue(period) self._pattern.SetValue(phrase) # rows = [] rows.append(('name: ', self._name)) rows.append(('folder path: ', self._path)) gridbox = ClientGUICommon.WrapInGrid(self._path_box, rows) self._path_box.Add(gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR) # text = '''regular - try to export the files to the directory, overwriting if the filesize if different synchronise - try to export the files to the directory, overwriting if the filesize if different, and delete anything else in the directory If you select synchronise, be careful!''' st = ClientGUICommon.BetterStaticText(self._type_box, label=text) st.SetWrapWidth(440) self._type_box.Add(st, CC.FLAGS_EXPAND_PERPENDICULAR) self._type_box.Add(self._type, CC.FLAGS_EXPAND_PERPENDICULAR) rows = [] rows.append(('delete files from client after export: ', self._delete_from_client_after_export)) gridbox = ClientGUICommon.WrapInGrid(self._type_box, rows) self._type_box.Add(gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR) self._query_box.Add(self._predicates_box, CC.FLAGS_EXPAND_BOTH_WAYS) self._query_box.Add(self._searchbox, CC.FLAGS_EXPAND_PERPENDICULAR) self._period_box.Add(self._period, CC.FLAGS_EXPAND_PERPENDICULAR) phrase_hbox = wx.BoxSizer(wx.HORIZONTAL) phrase_hbox.Add(self._pattern, CC.FLAGS_EXPAND_BOTH_WAYS) phrase_hbox.Add(self._examples, CC.FLAGS_VCENTER) self._phrase_box.Add(phrase_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self._path_box, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(self._type_box, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(self._query_box, CC.FLAGS_EXPAND_BOTH_WAYS) vbox.Add(self._period_box, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(self._phrase_box, CC.FLAGS_EXPAND_PERPENDICULAR) self.SetSizer(vbox) self._UpdateTypeDeleteUI() self._type.Bind(wx.EVT_CHOICE, self.EventTypeChoice) self._delete_from_client_after_export.Bind( wx.EVT_CHECKBOX, self.EventDeleteFilesAfterExport)
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 __init__( self, parent, info ): ClientGUIScrolledPanels.EditPanel.__init__( self, parent ) self._original_info = info ( self._mime, media_show_action, preview_show_action, ( media_scale_up, media_scale_down, preview_scale_up, preview_scale_down, exact_zooms_only, scale_up_quality, scale_down_quality ) ) = self._original_info possible_actions = CC.media_viewer_capabilities[ self._mime ] self._media_show_action = ClientGUICommon.BetterChoice( self ) self._preview_show_action = ClientGUICommon.BetterChoice( self ) for action in possible_actions: self._media_show_action.Append( CC.media_viewer_action_string_lookup[ action ], action ) if action != CC.MEDIA_VIEWER_ACTION_DO_NOT_SHOW_ON_ACTIVATION_OPEN_EXTERNALLY: self._preview_show_action.Append( CC.media_viewer_action_string_lookup[ action ], action ) self._media_show_action.Bind( wx.EVT_CHOICE, self.EventActionChange ) self._preview_show_action.Bind( wx.EVT_CHOICE, self.EventActionChange ) self._media_scale_up = ClientGUICommon.BetterChoice( self ) self._media_scale_down = ClientGUICommon.BetterChoice( self ) self._preview_scale_up = ClientGUICommon.BetterChoice( self ) self._preview_scale_down = ClientGUICommon.BetterChoice( self ) for scale_action in ( CC.MEDIA_VIEWER_SCALE_100, CC.MEDIA_VIEWER_SCALE_MAX_REGULAR, CC.MEDIA_VIEWER_SCALE_TO_CANVAS ): text = CC.media_viewer_scale_string_lookup[ scale_action ] self._media_scale_up.Append( text, scale_action ) self._preview_scale_up.Append( text, scale_action ) if scale_action != CC.MEDIA_VIEWER_SCALE_100: self._media_scale_down.Append( text, scale_action ) self._preview_scale_down.Append( text, scale_action ) self._exact_zooms_only = wx.CheckBox( self, label = 'only permit half and double zooms' ) self._exact_zooms_only.SetToolTipString( 'This limits zooms to 25%, 50%, 100%, 200%, 400%, and so on. It makes for fast resize and is useful for files that often have flat colours and hard edges, which often scale badly otherwise. The \'canvas fit\' zoom will still be inserted.' ) self._scale_up_quality = ClientGUICommon.BetterChoice( self ) for zoom in ( CC.ZOOM_NEAREST, CC.ZOOM_LINEAR, CC.ZOOM_CUBIC, CC.ZOOM_LANCZOS4 ): self._scale_up_quality.Append( CC.zoom_string_lookup[ zoom ], zoom ) self._scale_down_quality = ClientGUICommon.BetterChoice( self ) for zoom in ( CC.ZOOM_NEAREST, CC.ZOOM_LINEAR, CC.ZOOM_AREA ): self._scale_down_quality.Append( CC.zoom_string_lookup[ zoom ], zoom ) # self._media_show_action.SelectClientData( media_show_action ) self._preview_show_action.SelectClientData( preview_show_action ) self._media_scale_up.SelectClientData( media_scale_up ) self._media_scale_down.SelectClientData( media_scale_down ) self._preview_scale_up.SelectClientData( preview_scale_up ) self._preview_scale_down.SelectClientData( preview_scale_down ) self._exact_zooms_only.SetValue( exact_zooms_only ) self._scale_up_quality.SelectClientData( scale_up_quality ) self._scale_down_quality.SelectClientData( scale_down_quality ) # vbox = wx.BoxSizer( wx.VERTICAL ) text = 'Setting media view options for ' + HC.mime_string_lookup[ self._mime ] + '.' vbox.AddF( wx.StaticText( self, label = text ), CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( ClientGUICommon.WrapInText( self._media_show_action, self, 'media viewer show action:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) vbox.AddF( ClientGUICommon.WrapInText( self._preview_show_action, self, 'preview show action:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) if possible_actions == CC.no_support: self._media_scale_up.Hide() self._media_scale_down.Hide() self._preview_scale_up.Hide() self._preview_scale_down.Hide() self._exact_zooms_only.Hide() self._scale_up_quality.Hide() self._scale_down_quality.Hide() else: rows = [] rows.append( ( 'if the media is smaller than the media viewer canvas: ', self._media_scale_up ) ) rows.append( ( 'if the media is larger than the media viewer canvas: ', self._media_scale_down ) ) rows.append( ( 'if the media is smaller than the preview canvas: ', self._preview_scale_up) ) rows.append( ( 'if the media is larger than the preview canvas: ', self._preview_scale_down ) ) gridbox = ClientGUICommon.WrapInGrid( self, rows ) vbox.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) vbox.AddF( self._exact_zooms_only, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( wx.StaticText( self, label = 'Nearest neighbour is fast and ugly, 8x8 lanczos and area resampling are slower but beautiful.' ), CC.FLAGS_VCENTER ) vbox.AddF( ClientGUICommon.WrapInText( self._scale_up_quality, self, '>100% (interpolation) quality:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) vbox.AddF( ClientGUICommon.WrapInText( self._scale_down_quality, self, '<100% (decimation) quality:' ), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) if self._mime == HC.APPLICATION_FLASH: self._scale_up_quality.Disable() self._scale_down_quality.Disable() self.SetSizer( vbox )
def __init__( self, parent, service_type, account_type ): ClientGUIScrolledPanels.EditPanel.__init__( self, parent ) ( self._account_type_key, title, permissions, bandwidth_rules ) = account_type.ToTuple() self._title = wx.TextCtrl( self ) permission_choices = self._GeneratePermissionChoices( service_type ) self._permission_controls = [] self._permissions_panel = ClientGUICommon.StaticBox( self, 'permissions' ) gridbox_rows = [] for ( content_type, action_rows ) in permission_choices: choice_control = ClientGUICommon.BetterChoice( self._permissions_panel ) for ( label, action ) in action_rows: choice_control.Append( label, ( content_type, action ) ) if content_type in permissions: selection_row = ( content_type, permissions[ content_type ] ) else: selection_row = ( content_type, None ) try: choice_control.SelectClientData( selection_row ) except: choice_control.SelectClientData( ( content_type, None ) ) self._permission_controls.append( choice_control ) gridbox_label = HC.content_type_string_lookup[ content_type ] gridbox_rows.append( ( gridbox_label, choice_control ) ) gridbox = ClientGUICommon.WrapInGrid( self._permissions_panel, gridbox_rows ) self._bandwidth_rules_control = ClientGUIControls.BandwidthRulesCtrl( self, bandwidth_rules ) # self._title.SetValue( title ) # t_hbox = ClientGUICommon.WrapInText( self._title, self, 'title: ' ) self._permissions_panel.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) vbox = wx.BoxSizer( wx.VERTICAL ) vbox.AddF( t_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) vbox.AddF( self._permissions_panel, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._bandwidth_rules_control, CC.FLAGS_EXPAND_PERPENDICULAR ) self.SetSizer( vbox )
def __init__( self, parent, info ): ClientGUIScrolledPanels.EditPanel.__init__( self, parent ) self._original_info = info self._remember_size = wx.CheckBox( self, label = 'remember size' ) self._remember_position = wx.CheckBox( self, label = 'remember position' ) self._last_size = ClientGUICommon.NoneableSpinCtrl( self, 'last size', none_phrase = 'none set', min = 100, max = 1000000, unit = None, num_dimensions = 2 ) self._last_position = ClientGUICommon.NoneableSpinCtrl( self, 'last position', none_phrase = 'none set', min = -1000000, max = 1000000, unit = None, num_dimensions = 2 ) self._default_gravity_x = ClientGUICommon.BetterChoice( self ) self._default_gravity_x.Append( 'by default, expand to width of parent', 1 ) self._default_gravity_x.Append( 'by default, expand width as much as needed', -1 ) self._default_gravity_y = ClientGUICommon.BetterChoice( self ) self._default_gravity_y.Append( 'by default, expand to height of parent', 1 ) self._default_gravity_y.Append( 'by default, expand height as much as needed', -1 ) self._default_position = ClientGUICommon.BetterChoice( self ) self._default_position.Append( 'by default, position off the top-left corner of parent', 'topleft' ) self._default_position.Append( 'by default, position centered on the parent', 'center' ) self._maximised = wx.CheckBox( self, label = 'start maximised' ) self._fullscreen = wx.CheckBox( self, label = 'start fullscreen' ) # ( name, remember_size, remember_position, last_size, last_position, default_gravity, default_position, maximised, fullscreen ) = self._original_info self._remember_size.SetValue( remember_size ) self._remember_position.SetValue( remember_position ) self._last_size.SetValue( last_size ) self._last_position.SetValue( last_position ) ( x, y ) = default_gravity self._default_gravity_x.SelectClientData( x ) self._default_gravity_y.SelectClientData( y ) self._default_position.SelectClientData( default_position ) self._maximised.SetValue( maximised ) self._fullscreen.SetValue( fullscreen ) # vbox = wx.BoxSizer( wx.VERTICAL ) text = 'Setting frame location info for ' + name + '.' vbox.AddF( wx.StaticText( self, label = text ), CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._remember_size, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._remember_position, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._last_size, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._last_position, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._default_gravity_x, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._default_gravity_y, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._default_position, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._maximised, CC.FLAGS_EXPAND_PERPENDICULAR ) vbox.AddF( self._fullscreen, CC.FLAGS_EXPAND_PERPENDICULAR ) self.SetSizer( vbox )
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')