def __init__(self, parent, controller, page_key=None): wx.Panel.__init__(self, parent, style=wx.BORDER_DOUBLE) self._controller = controller self._page_key = page_key self._file_seed_cache = None self._import_summary_st = ClientGUICommon.BetterStaticText(self) self._progress_st = ClientGUICommon.BetterStaticText(self) self._file_seed_cache_button = FileSeedCacheButton( self, self._controller, self._GetFileSeedCache) self._progress_gauge = ClientGUICommon.Gauge(self) # self._Update() # hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self._progress_st, CC.FLAGS_VCENTER_EXPAND_DEPTH_ONLY) hbox.Add(self._file_seed_cache_button, CC.FLAGS_VCENTER) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self._import_summary_st, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR) vbox.Add(self._progress_gauge, CC.FLAGS_EXPAND_PERPENDICULAR) self.SetSizer(vbox) # HG.client_controller.gui.RegisterUIUpdateWindow(self)
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): 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, canvas_key): FullscreenHoverFrame.__init__(self, parent, canvas_key) self._current_zoom = 1.0 self._current_index_string = '' self._top_hbox = wx.BoxSizer(wx.HORIZONTAL) self._title_text = ClientGUICommon.BetterStaticText(self, 'title') self._info_text = ClientGUICommon.BetterStaticText(self, 'info') self._additional_info_text = ClientGUICommon.BetterStaticText( self, '', style=wx.ALIGN_CENTER) self._button_hbox = wx.BoxSizer(wx.HORIZONTAL) self._PopulateLeftButtons() self._top_hbox.AddF((20, 20), CC.FLAGS_EXPAND_BOTH_WAYS) self._PopulateCenterButtons() self._top_hbox.AddF((20, 20), CC.FLAGS_EXPAND_BOTH_WAYS) self._PopulateRightButtons() vbox = wx.BoxSizer(wx.VERTICAL) vbox.AddF(self._top_hbox, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.AddF(self._title_text, CC.FLAGS_CENTER) vbox.AddF(self._info_text, CC.FLAGS_CENTER) vbox.AddF(self._additional_info_text, CC.FLAGS_CENTER) vbox.AddF(self._button_hbox, CC.FLAGS_CENTER) self.SetSizer(vbox) HG.client_controller.sub(self, 'ProcessContentUpdates', 'content_updates_gui') HG.client_controller.sub(self, 'SetCurrentZoom', 'canvas_new_zoom') HG.client_controller.sub(self, 'SetIndexString', 'canvas_new_index_string') self.Bind(wx.EVT_MOUSEWHEEL, self.EventMouseWheel)
def __init__( self, parent ): PanelPredicateSystem.__init__( self, parent ) choices = [ '<', u'\u2248', '=', '>' ] self._sign = wx.RadioBox( self, choices = choices, style = wx.RA_SPECIFY_COLS ) self._duration_s = wx.SpinCtrl( self, max = 3599, size = ( 60, -1 ) ) self._duration_ms = wx.SpinCtrl( self, max = 999, size = ( 60, -1 ) ) system_predicates = HC.options[ 'file_system_predicates' ] ( sign, ms ) = system_predicates[ 'duration' ] s = ms / 1000 ms = ms % 1000 self._sign.SetStringSelection( sign ) self._duration_s.SetValue( s ) self._duration_ms.SetValue( ms ) hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:duration' ), CC.FLAGS_VCENTER ) hbox.Add( self._sign, CC.FLAGS_VCENTER ) hbox.Add( self._duration_s, CC.FLAGS_VCENTER ) hbox.Add( ClientGUICommon.BetterStaticText( self, 's' ), CC.FLAGS_VCENTER ) hbox.Add( self._duration_ms, CC.FLAGS_VCENTER ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'ms' ), CC.FLAGS_VCENTER ) self.SetSizer( hbox ) wx.CallAfter( self._duration_s.SetFocus )
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, controller, read_only, gallery_seed_log): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._controller = controller self._read_only = read_only self._gallery_seed_log = gallery_seed_log self._text = ClientGUICommon.BetterStaticText(self, 'initialising') # add index control row here, hide it if needed and hook into showing/hiding and postsizechangedevent on gallery_seed add/remove columns = [('#', 3), ('url', -1), ('status', 12), ('added', 23), ('last modified', 23), ('note', 20)] self._list_ctrl = ClientGUIListCtrl.BetterListCtrl( self, 'gallery_seed_log', 30, 30, columns, self._ConvertGallerySeedToListCtrlTuples, delete_key_callback=self._DeleteSelected) # self._list_ctrl.AddDatas(self._gallery_seed_log.GetGallerySeeds()) self._list_ctrl.Sort(0) # vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self._text, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(self._list_ctrl, CC.FLAGS_EXPAND_BOTH_WAYS) self.SetSizer(vbox) self._list_ctrl.Bind(wx.EVT_RIGHT_DOWN, self.EventShowMenu) self._controller.sub(self, 'NotifyGallerySeedsUpdated', 'gallery_seed_log_gallery_seeds_updated') wx.CallAfter(self._UpdateText)
def __init__( self, parent ): PopupWindow.__init__( self, parent ) hbox = wx.BoxSizer( wx.HORIZONTAL ) self._text = ClientGUICommon.BetterStaticText( self ) self._text.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss ) button = wx.Button( self, label = 'dismiss all' ) button.Bind( wx.EVT_BUTTON, self.EventButton ) button.Bind( wx.EVT_RIGHT_DOWN, self.EventDismiss ) hbox.Add( self._text, CC.FLAGS_VCENTER ) hbox.Add( ( 20, 20 ), CC.FLAGS_EXPAND_BOTH_WAYS ) hbox.Add( button, CC.FLAGS_VCENTER ) self.SetSizer( hbox )
def __init__(self, parent, controller, file_seed_cache): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._controller = controller self._file_seed_cache = file_seed_cache self._text = ClientGUICommon.BetterStaticText(self, 'initialising') # add index control row here, hide it if needed and hook into showing/hiding and postsizechangedevent on file_seed add/remove columns = [('#', 3), ('source', -1), ('status', 12), ('added', 23), ('last modified', 23), ('source time', 23), ('note', 20)] self._list_ctrl = ClientGUIListCtrl.BetterListCtrl( self, 'file_seed_cache', 30, 30, columns, self._ConvertFileSeedToListCtrlTuples, delete_key_callback=self._DeleteSelected) # self._list_ctrl.AddDatas(self._file_seed_cache.GetFileSeeds()) self._list_ctrl.Sort(0) # vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self._text, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(self._list_ctrl, CC.FLAGS_EXPAND_BOTH_WAYS) self.SetSizer(vbox) self._list_ctrl.AddMenuCallable(self._GetListCtrlMenu) self._controller.sub(self, 'NotifyFileSeedsUpdated', 'file_seed_cache_file_seeds_updated') wx.CallAfter(self._UpdateText)
def __init__(self, parent): PanelPredicateSystem.__init__(self, parent) choices = ['<', u'\u2248', '=', '>'] self._sign = wx.RadioBox(self, choices=choices, style=wx.RA_SPECIFY_COLS) self._num = wx.SpinCtrl(self, min=0, max=65535) choices = [ (HC.duplicate_type_string_lookup[status], status) for status in (HC.DUPLICATE_BETTER_OR_WORSE, HC.DUPLICATE_BETTER, HC.DUPLICATE_WORSE, HC.DUPLICATE_SAME_QUALITY, HC.DUPLICATE_ALTERNATE, HC.DUPLICATE_NOT_DUPLICATE, HC.DUPLICATE_UNKNOWN) ] self._dupe_type = ClientGUICommon.BetterRadioBox( self, choices=choices, style=wx.RA_SPECIFY_ROWS) # self._sign.SetStringSelection('>') self._num.SetValue(0) # hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:num duplicate relationships'), CC.FLAGS_VCENTER) hbox.Add(self._sign, CC.FLAGS_VCENTER) hbox.Add(self._num, CC.FLAGS_VCENTER) hbox.Add(self._dupe_type, CC.FLAGS_VCENTER) self.SetSizer(hbox) wx.CallAfter(self._num.SetFocus)
def __init__( self, parent ): PanelPredicateSystem.__init__( self, parent ) self._limit = wx.SpinCtrl( self, max = 1000000, size = ( 60, -1 ) ) system_predicates = HC.options[ 'file_system_predicates' ] limit = system_predicates[ 'limit' ] self._limit.SetValue( limit ) hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:limit=' ), CC.FLAGS_VCENTER ) hbox.Add( self._limit, CC.FLAGS_VCENTER ) self.SetSizer( hbox ) wx.CallAfter( self._limit.SetFocus )
def __init__(self, parent, export_folders): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._export_folders_panel = ClientGUIListCtrl.BetterListCtrlPanel( self) columns = [('name', 20), ('path', -1), ('type', 12), ('query', 16), ('period', 10), ('phrase', 20)] self._export_folders = ClientGUIListCtrl.BetterListCtrl( self._export_folders_panel, 'export_folders', 6, 40, columns, self._ConvertExportFolderToListCtrlTuples, use_simple_delete=True, activation_callback=self._Edit) self._export_folders_panel.SetListCtrl(self._export_folders) self._export_folders_panel.AddButton('add', self._AddFolder) self._export_folders_panel.AddButton('edit', self._Edit, enabled_only_on_selection=True) self._export_folders_panel.AddDeleteButton() # self._export_folders.AddDatas(export_folders) vbox = wx.BoxSizer(wx.VERTICAL) intro = 'Here you can set the client to regularly export a certain query to a particular location.' vbox.Add(ClientGUICommon.BetterStaticText(self, intro), CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(self._export_folders_panel, CC.FLAGS_EXPAND_BOTH_WAYS) self.SetSizer(vbox)
def _PopulateLeftButtons(self): self._previous_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.previous, HG.client_controller.pub, 'canvas_application_command', self._canvas_key, ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_previous')) self._previous_button.SetToolTipString('previous') self._index_text = ClientGUICommon.BetterStaticText(self, 'index') self._next_button = ClientGUICommon.BetterBitmapButton( self, CC.GlobalBMPs.next, HG.client_controller.pub, 'canvas_application_command', self._canvas_key, ClientData.ApplicationCommand(CC.APPLICATION_COMMAND_TYPE_SIMPLE, 'view_next')) 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)
def __init__( self, parent ): PanelPredicateSystem.__init__( self, parent ) self.SetToolTip( 'As this can only ever return one result, it overrules the active file domain and any other active predicate.' ) self._hash = wx.TextCtrl( self, size = ( 200, -1 ) ) choices = [ 'sha256', 'md5', 'sha1', 'sha512' ] self._hash_type = wx.RadioBox( self, choices = choices, style = wx.RA_SPECIFY_COLS ) hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:hash=' ), CC.FLAGS_VCENTER ) hbox.Add( self._hash, CC.FLAGS_VCENTER ) hbox.Add( self._hash_type, CC.FLAGS_VCENTER ) self.SetSizer( hbox ) wx.CallAfter( self._hash.SetFocus )
def __init__(self, parent, controller, read_only, can_generate_more_pages, page_key=None): wx.Panel.__init__(self, parent, style=wx.BORDER_DOUBLE) self._controller = controller self._read_only = read_only self._can_generate_more_pages = can_generate_more_pages self._page_key = page_key self._gallery_seed_log = None self._log_summary_st = ClientGUICommon.BetterStaticText( self, style=wx.ST_ELLIPSIZE_END) self._gallery_seed_log_button = GallerySeedLogButton( self, self._controller, self._read_only, self._can_generate_more_pages, self._GetGallerySeedLog) # self._Update() # hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self._log_summary_st, CC.FLAGS_VCENTER_EXPAND_DEPTH_ONLY) hbox.Add(self._gallery_seed_log_button, CC.FLAGS_VCENTER) self.SetSizer(hbox) # HG.client_controller.gui.RegisterUIUpdateWindow(self)
def __init__(self, parent, min_time_delta=60, days=False, hours=False, minutes=False, seconds=False, per_phrase='per', unit=None): wx.Panel.__init__(self, parent) self._num = wx.SpinCtrl(self, min=0, max=1000, size=(60, -1)) self._times = TimeDeltaCtrl(self, min=min_time_delta, days=days, hours=hours, minutes=minutes, seconds=seconds) # hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self._num, CC.FLAGS_VCENTER) mid_text = per_phrase if unit is not None: mid_text = unit + ' ' + mid_text hbox.Add(ClientGUICommon.BetterStaticText(self, mid_text), CC.FLAGS_VCENTER) hbox.Add(self._times, CC.FLAGS_VCENTER) self.SetSizer(hbox)
def __init__(self, parent, controller, seed_cache): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._controller = controller self._seed_cache = seed_cache self._text = ClientGUICommon.BetterStaticText(self, 'initialising') # add index control row here, hide it if needed and hook into showing/hiding and postsizechangedevent on seed add/remove columns = [('#', 3), ('source', -1), ('status', 12), ('added', 23), ('last modified', 23), ('source time', 23), ('note', 20)] self._list_ctrl = ClientGUIListCtrl.BetterListCtrl( self, 'seed_cache', 30, 30, columns, self._ConvertSeedToListCtrlTuples) # self._AddSeeds(self._seed_cache.GetSeeds()) self._list_ctrl.Sort(0) # vbox = wx.BoxSizer(wx.VERTICAL) vbox.AddF(self._text, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.AddF(self._list_ctrl, CC.FLAGS_EXPAND_BOTH_WAYS) self.SetSizer(vbox) self._list_ctrl.Bind(wx.EVT_RIGHT_DOWN, self.EventShowMenu) self._controller.sub(self, 'NotifySeedsUpdated', 'seed_cache_seeds_updated') wx.CallAfter(self._UpdateText)
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 )
def __init__( self, parent ): PanelPredicateSystem.__init__( self, parent ) self._sign = wx.RadioBox( self, choices = [ '<', u'\u2248', '=', '>' ] ) self._date = wx.adv.CalendarCtrl( self ) wx_dt = wx.DateTime.Today() wx_dt.Subtract( wx.TimeSpan( 24 * 7 ) ) self._date.SetDate( wx_dt ) self._sign.SetStringSelection( '>' ) hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:time imported' ), CC.FLAGS_VCENTER ) hbox.Add( self._sign, CC.FLAGS_VCENTER ) hbox.Add( self._date, CC.FLAGS_VCENTER ) self.SetSizer( hbox )
def __init__( self, parent ): PanelPredicateSystem.__init__( self, parent ) self._mimes = ClientGUIOptionsPanels.OptionsPanelMimes( self, HC.SEARCHABLE_MIMES ) system_predicates = HC.options[ 'file_system_predicates' ] mimes = system_predicates[ 'mime' ] if isinstance( mimes, int ): mimes = ( mimes, ) self._mimes.SetValue( mimes ) hbox = wx.BoxSizer( wx.HORIZONTAL ) hbox.Add( ClientGUICommon.BetterStaticText( self, 'system:mime' ), CC.FLAGS_VCENTER ) hbox.Add( self._mimes, CC.FLAGS_VCENTER ) self.SetSizer( hbox )
def __init__(self, parent): PanelPredicateSystem.__init__(self, parent) self._sign = ClientGUICommon.BetterRadioBox(self, choices=[('is', True), ('is not', False) ], style=wx.RA_SPECIFY_ROWS) self._current_pending = ClientGUICommon.BetterRadioBox( self, choices=[('currently in', HC.CONTENT_STATUS_CURRENT), ('pending to', HC.CONTENT_STATUS_PENDING)], style=wx.RA_SPECIFY_ROWS) services = HG.client_controller.services_manager.GetServices( HC.FILE_SERVICES) choices = [(service.GetName(), service.GetServiceKey()) for service in services] self._file_service_key = ClientGUICommon.BetterRadioBox( self, choices=choices, style=wx.RA_SPECIFY_ROWS) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add( ClientGUICommon.BetterStaticText(self, 'system:file service:'), CC.FLAGS_VCENTER) hbox.Add(self._sign, CC.FLAGS_VCENTER) hbox.Add(self._current_pending, CC.FLAGS_VCENTER) hbox.Add(self._file_service_key, CC.FLAGS_VCENTER) self.SetSizer(hbox) wx.CallAfter(self._sign.SetFocus)
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) self._right_text = ClientGUICommon.BetterStaticText( self, style=wx.ALIGN_RIGHT) # 512/768KB - 200KB/s right_width = ClientGUICommon.ConvertTextToPixelWidth( self._right_text, 20) self._right_text.SetMinSize((right_width, -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, 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): PanelPredicateSystem.__init__(self, parent) # local_like_services = HG.client_controller.services_manager.GetServices( (HC.LOCAL_RATING_LIKE, ), randomised=False) self._like_checkboxes_to_info = {} self._like_rating_ctrls = [] gridbox = wx.FlexGridSizer(5) gridbox.AddGrowableCol(0, 1) for service in local_like_services: name = service.GetName() service_key = service.GetServiceKey() rated_checkbox = wx.CheckBox(self, label='rated') not_rated_checkbox = wx.CheckBox(self, label='not rated') rating_ctrl = ClientGUICommon.RatingLikeDialog(self, service_key) self._like_checkboxes_to_info[rated_checkbox] = (service_key, ClientRatings.SET) self._like_checkboxes_to_info[not_rated_checkbox] = ( service_key, ClientRatings.NULL) self._like_rating_ctrls.append(rating_ctrl) gridbox.Add(ClientGUICommon.BetterStaticText(self, name), CC.FLAGS_VCENTER) gridbox.Add(rated_checkbox, CC.FLAGS_VCENTER) gridbox.Add(not_rated_checkbox, CC.FLAGS_VCENTER) gridbox.Add((20, 20), CC.FLAGS_EXPAND_SIZER_BOTH_WAYS) gridbox.Add(rating_ctrl, CC.FLAGS_VCENTER) # local_numerical_services = HG.client_controller.services_manager.GetServices( (HC.LOCAL_RATING_NUMERICAL, ), randomised=False) self._numerical_checkboxes_to_info = {} self._numerical_rating_ctrls_to_info = {} for service in local_numerical_services: name = service.GetName() service_key = service.GetServiceKey() rated_checkbox = wx.CheckBox(self, label='rated') not_rated_checkbox = wx.CheckBox(self, label='not rated') choice = wx.RadioBox(self, choices=['>', '<', '=', u'\u2248']) rating_ctrl = ClientGUICommon.RatingNumericalDialog( self, service_key) choice.SetSelection(2) self._numerical_checkboxes_to_info[rated_checkbox] = ( service_key, ClientRatings.SET) self._numerical_checkboxes_to_info[not_rated_checkbox] = ( service_key, ClientRatings.NULL) self._numerical_rating_ctrls_to_info[rating_ctrl] = choice gridbox.Add(ClientGUICommon.BetterStaticText(self, name), CC.FLAGS_VCENTER) gridbox.Add(rated_checkbox, CC.FLAGS_VCENTER) gridbox.Add(not_rated_checkbox, CC.FLAGS_VCENTER) gridbox.Add(choice, CC.FLAGS_VCENTER) gridbox.Add(rating_ctrl, CC.FLAGS_VCENTER) # vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(gridbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS) self.SetSizer(vbox)
def __init__(self, parent, min=1, days=False, hours=False, minutes=False, seconds=False, monthly_allowed=False, monthly_label='monthly'): wx.Panel.__init__(self, parent) self._min = min self._show_days = days self._show_hours = hours self._show_minutes = minutes self._show_seconds = seconds self._monthly_allowed = monthly_allowed hbox = wx.BoxSizer(wx.HORIZONTAL) if self._show_days: self._days = wx.SpinCtrl(self, min=0, max=3653, size=(50, -1)) self._days.Bind(wx.EVT_SPINCTRL, self.EventChange) hbox.Add(self._days, CC.FLAGS_VCENTER) hbox.Add(ClientGUICommon.BetterStaticText(self, 'days'), CC.FLAGS_VCENTER) if self._show_hours: self._hours = wx.SpinCtrl(self, min=0, max=23, size=(45, -1)) self._hours.Bind(wx.EVT_SPINCTRL, self.EventChange) hbox.Add(self._hours, CC.FLAGS_VCENTER) hbox.Add(ClientGUICommon.BetterStaticText(self, 'hours'), CC.FLAGS_VCENTER) if self._show_minutes: self._minutes = wx.SpinCtrl(self, min=0, max=59, size=(45, -1)) self._minutes.Bind(wx.EVT_SPINCTRL, self.EventChange) hbox.Add(self._minutes, CC.FLAGS_VCENTER) hbox.Add(ClientGUICommon.BetterStaticText(self, 'minutes'), CC.FLAGS_VCENTER) if self._show_seconds: self._seconds = wx.SpinCtrl(self, min=0, max=59, size=(45, -1)) self._seconds.Bind(wx.EVT_SPINCTRL, self.EventChange) hbox.Add(self._seconds, CC.FLAGS_VCENTER) hbox.Add(ClientGUICommon.BetterStaticText(self, 'seconds'), CC.FLAGS_VCENTER) if self._monthly_allowed: self._monthly = wx.CheckBox(self) self._monthly.Bind(wx.EVT_CHECKBOX, self.EventChange) hbox.Add(self._monthly, CC.FLAGS_VCENTER) hbox.Add(ClientGUICommon.BetterStaticText(self, monthly_label), CC.FLAGS_VCENTER) self.SetSizer(hbox)
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()
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 _InitWhitelistPanel(self): whitelist_panel = wx.Panel(self._notebook) # self._simple_whitelist_error_st = ClientGUICommon.BetterStaticText( whitelist_panel) self._simple_whitelist_global_checkboxes = ClientGUICommon.BetterCheckListBox( whitelist_panel) self._simple_whitelist_global_checkboxes.Append( 'unnamespaced tags', '') self._simple_whitelist_global_checkboxes.Append('namespaced tags', ':') self._simple_whitelist_namespace_checkboxes = ClientGUICommon.BetterCheckListBox( whitelist_panel) for namespace in self._namespaces: if namespace == '': continue self._simple_whitelist_namespace_checkboxes.Append( namespace, namespace + ':') self._simple_whitelist = ClientGUIListBoxes.ListBoxTagsCensorship( whitelist_panel, removed_callable=self._SimpleWhitelistRemoved) self._simple_whitelist_input = ClientGUIControls.TextAndPasteCtrl( whitelist_panel, self._SimpleAddWhitelistMultiple, allow_empty_input=True) # left_vbox = wx.BoxSizer(wx.VERTICAL) left_vbox.Add(self._simple_whitelist_global_checkboxes, CC.FLAGS_EXPAND_PERPENDICULAR) left_vbox.Add((20, 20), CC.FLAGS_EXPAND_PERPENDICULAR) left_vbox.Add(self._simple_whitelist_namespace_checkboxes, CC.FLAGS_EXPAND_PERPENDICULAR) right_vbox = wx.BoxSizer(wx.VERTICAL) right_vbox.Add(self._simple_whitelist, CC.FLAGS_EXPAND_BOTH_WAYS) right_vbox.Add(self._simple_whitelist_input, CC.FLAGS_EXPAND_PERPENDICULAR) main_hbox = wx.BoxSizer(wx.HORIZONTAL) main_hbox.Add(left_vbox, CC.FLAGS_EXPAND_BOTH_WAYS) main_hbox.Add(right_vbox, CC.FLAGS_EXPAND_BOTH_WAYS) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self._simple_whitelist_error_st, CC.FLAGS_EXPAND_PERPENDICULAR) vbox.Add(main_hbox, CC.FLAGS_EXPAND_BOTH_WAYS) whitelist_panel.SetSizer(vbox) return whitelist_panel
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)
def _PopulateLeftButtons(self): self._index_text = ClientGUICommon.BetterStaticText(self, 'index') self._top_hbox.AddF(self._index_text, CC.FLAGS_VCENTER)