예제 #1
0
    def __init__(self, parent):

        OptionsPanel.__init__(self, parent)

        self._auto_archive = wx.CheckBox(self, label='archive all imports')
        self._auto_archive.Bind(wx.EVT_CHECKBOX, self.EventChanged)

        self._exclude_deleted = wx.CheckBox(
            self, label='exclude already deleted files')
        self._exclude_deleted.Bind(wx.EVT_CHECKBOX, self.EventChanged)

        self._min_size = ClientGUICommon.NoneableSpinCtrl(
            self, 'minimum size (KB): ', multiplier=1024)
        self._min_size.SetValue(5120)
        self._min_size.Bind(wx.EVT_SPINCTRL, self.EventChanged)

        self._min_resolution = ClientGUICommon.NoneableSpinCtrl(
            self, 'minimum resolution: ', num_dimensions=2)
        self._min_resolution.SetValue((50, 50))
        self._min_resolution.Bind(wx.EVT_SPINCTRL, self.EventChanged)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.AddF(self._auto_archive, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._exclude_deleted, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._min_size, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._min_resolution, CC.FLAGS_EXPAND_PERPENDICULAR)

        self.SetSizer(vbox)

        self.SetOptions(ClientDefaults.GetDefaultImportFileOptions())
예제 #2
0
 def __init__( self, parent, dictionary ):
     
     ClientGUICommon.StaticBox.__init__( self, parent, 'file repository' )
     
     self._log_uploader_ips = wx.CheckBox( self )
     self._max_storage = ClientGUICommon.NoneableSpinCtrl( self, unit = 'MB', multiplier = 1024 * 1024 )
     
     #
     
     log_uploader_ips = dictionary[ 'log_uploader_ips' ]
     max_storage = dictionary[ 'max_storage' ]
     
     self._log_uploader_ips.SetValue( log_uploader_ips )
     self._max_storage.SetValue( max_storage )
     
     #
     
     rows = []
     
     rows.append( ( 'log file uploader IP addresses?: ', self._log_uploader_ips ) )
     rows.append( ( 'max file storage: ', self._max_storage ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self, rows )
     
     self.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
예제 #3
0
    def __init__(self, parent):

        OptionsPanel.__init__(self, parent)

        self._auto_archive = wx.CheckBox(self, label='archive all imports')
        self._auto_archive.Bind(wx.EVT_CHECKBOX, self.EventChanged)
        self._auto_archive.SetToolTipString(
            'If this is set, all successful imports will be automatically archived rather than sent to the inbox.'
        )

        self._exclude_deleted = wx.CheckBox(
            self, label='exclude previously deleted files')
        self._exclude_deleted.Bind(wx.EVT_CHECKBOX, self.EventChanged)
        self._exclude_deleted.SetToolTipString(
            'If this is set and an incoming file has already been seen and deleted before by this client, the import will be abandoned. This is useful to make sure you do not keep importing and deleting the same bad files over and over. Files currently in the trash count as deleted.'
        )

        self._min_size = ClientGUICommon.NoneableSpinCtrl(self,
                                                          'size',
                                                          unit='KB',
                                                          multiplier=1024)
        self._min_size.SetValue(5120)
        self._min_size.Bind(wx.EVT_SPINCTRL, self.EventChanged)

        self._min_resolution = ClientGUICommon.NoneableSpinCtrl(
            self, 'resolution', num_dimensions=2)
        self._min_resolution.SetValue((50, 50))
        self._min_resolution.Bind(wx.EVT_SPINCTRL, self.EventChanged)

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.AddF(self._auto_archive, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._exclude_deleted, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(wx.StaticText(self, label='minimum:'),
                  CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._min_size, CC.FLAGS_EXPAND_PERPENDICULAR)
        vbox.AddF(self._min_resolution, CC.FLAGS_EXPAND_PERPENDICULAR)

        self.SetSizer(vbox)

        self.SetOptions(ClientDefaults.GetDefaultImportFileOptions())
예제 #4
0
 def __init__( self, parent, name, port, dictionary ):
     
     ClientGUICommon.StaticBox.__init__( self, parent, 'basic information' )
     
     self._name = wx.TextCtrl( self )
     self._port = wx.SpinCtrl( self, min = 1, max = 65535 )
     self._upnp_port = ClientGUICommon.NoneableSpinCtrl( self, 'external upnp port', none_phrase = 'do not forward port', min = 1, max = 65535 )
     
     self._bandwidth_tracker_st = wx.StaticText( self )
     
     #
     
     self._name.SetValue( name )
     self._port.SetValue( port )
     
     upnp_port = dictionary[ 'upnp_port' ]
     
     self._upnp_port.SetValue( upnp_port )
     
     bandwidth_tracker = dictionary[ 'bandwidth_tracker' ]
     
     bandwidth_text = bandwidth_tracker.GetCurrentMonthSummary()
     
     self._bandwidth_tracker_st.SetLabelText( bandwidth_text )
     
     #
     
     rows = []
     
     rows.append( ( 'name: ', self._name ) )
     rows.append( ( 'port: ', self._port ) )
     rows.append( ( 'upnp port: ', self._upnp_port ) )
     
     gridbox = ClientGUICommon.WrapInGrid( self, rows )
     
     self.AddF( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
     self.AddF( self._bandwidth_tracker_st, CC.FLAGS_EXPAND_PERPENDICULAR )
예제 #5
0
 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 )
예제 #6
0
 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 )