Skip to content

Commit 9a90c99

Browse files
author
KirillMysnik
committed
Internal naming changes
1 parent ddd645c commit 9a90c99

File tree

13 files changed

+79
-83
lines changed

13 files changed

+79
-83
lines changed

srcds/addons/source-python/plugins/admin/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .core.events.storage import admin_resource_list
1313
from .core.listeners import (on_spa_loaded_listener_manager,
1414
on_spa_unloaded_listener_manager)
15-
from .core.frontends.menus import AdminMenuSection
15+
from .core.frontends.menus import MenuSection
1616
from .core.frontends.motd import MainPage
1717
from .core.orm import Base, engine
1818
from .core.plugins.command import admin_command_manager
@@ -29,7 +29,7 @@
2929
# =============================================================================
3030
# >> GLOBAL VARIABLES
3131
# =============================================================================
32-
main_menu = AdminMenuSection(None, strings_common['title main'], 'admin')
32+
main_menu = MenuSection(None, strings_common['title main'], 'admin')
3333

3434

3535
# =============================================================================

srcds/addons/source-python/plugins/admin/core/frontends/menus.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# =============================================================================
2222
# >> CLASSES
2323
# =============================================================================
24-
class AdminMenuEntry:
24+
class MenuEntry:
2525
"""Represent a selectable entry in main admin menu or its submenus."""
2626
def __init__(self, parent, title, id_=None):
2727
self._parent = parent
@@ -50,7 +50,7 @@ def select(self, client):
5050
raise NotImplementedError
5151

5252

53-
class AdminMenuSection(AdminMenuEntry, list):
53+
class MenuSection(MenuEntry, list):
5454
"""Represents a selectable section of other entries in admin menus."""
5555
def __init__(self, parent, title, id_=None):
5656
super().__init__(parent, title, id_)
@@ -77,7 +77,7 @@ def build_callback(popup, index):
7777
continue
7878

7979
selectable = item.is_selectable(client)
80-
if isinstance(item, AdminMenuSection):
80+
if isinstance(item, MenuSection):
8181
title = strings_menus['extensible'].tokenized(
8282
item=item.title)
8383
else:
@@ -93,9 +93,9 @@ def build_callback(popup, index):
9393
def add_entry(self, entry):
9494
"""Add another entry to this section then sort again.
9595
96-
:param AdminMenuEntry entry: Given entry.
96+
:param MenuEntry entry: Given entry.
9797
:return: Passed entry without alteration.
98-
:rtype: AdminMenuEntry
98+
:rtype: MenuEntry
9999
"""
100100
self.append(entry)
101101
self.sort(key=lambda entry_: (self.order.index(entry_.id)
@@ -145,13 +145,13 @@ def select(self, client):
145145
client.send_popup(self.popup)
146146

147147

148-
class AdminCommand(AdminMenuEntry):
148+
class MenuCommand(MenuEntry):
149149
"""Base class for entry that is bound to execute a feature."""
150150
def __init__(self, feature, parent, title, id_=None):
151-
"""Initialize AdminCommand instance.
151+
"""Initialize MenuCommand instance.
152152
153153
:param feature: Feature instance this entry is bound to execute.
154-
:param parent: Parent AdminMenuSection instance.
154+
:param parent: Parent MenuSection instance.
155155
:param title: TranslationStrings instance.
156156
:param str|None id_: String ID that will be used to sort this item.
157157
"""
@@ -186,10 +186,6 @@ def is_selectable(self, client):
186186
return client.has_permission(self.feature.flag)
187187

188188
def select(self, client):
189-
if not self.is_visible(client) or not self.is_selectable(client):
190-
client.tell(strings_common['unavailable'])
191-
return
192-
193189
client.active_popup = None
194190

195191
self.feature.execute(client)
@@ -226,18 +222,18 @@ def __init__(self):
226222
self.options = []
227223

228224

229-
class BasePlayerBasedAdminCommand(AdminCommand):
225+
class BasePlayerBasedMenuCommand(MenuCommand):
230226
"""Base class for entry that is bound to perform a command on the players.
231227
"""
232228
# Allow selecting multiple players at once?
233229
allow_multiple_choices = True
234230

235231
def __init__(self, feature, parent, title, id_=None):
236-
"""Initialize BasePlayerBasedAdminCommand instance.
232+
"""Initialize BasePlayerBasedMenuCommand instance.
237233
238234
:param feature: PlayerBasedFeature instance this entry is bound to
239235
execute.
240-
:param parent: Parent AdminMenuSection instance.
236+
:param parent: Parent MenuSection instance.
241237
:param title: TranslationStrings instance.
242238
:param str|None id_: String ID that will be used to sort this item.
243239
"""
@@ -506,10 +502,6 @@ def _player_select(self, client, player_ids):
506502
:param list player_ids: Unfiltered list of IDs.
507503
"""
508504

509-
if not self.is_visible(client) or not self.is_selectable(client):
510-
client.tell(strings_common['unavailable'])
511-
return
512-
513505
client.active_popup = None
514506

515507
for player in self._filter_player_ids(client, player_ids):
@@ -532,10 +524,14 @@ def render_player_name(player):
532524
return format_player_name(player.name)
533525

534526
def select(self, client):
527+
if not self.is_visible(client) or not self.is_selectable(client):
528+
client.tell(strings_common['unavailable'])
529+
return
530+
535531
client.send_popup(self.popup)
536532

537533

538-
class PlayerBasedAdminCommand(BasePlayerBasedAdminCommand):
534+
class PlayerBasedMenuCommand(BasePlayerBasedMenuCommand):
539535
base_filter = 'all'
540536

541537
def _get_player_id(self, player):

srcds/addons/source-python/plugins/admin/plugins/included/admin_comm_management/admin_comm_management.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,59 @@
33
# =============================================================================
44
# Source.Python Admin
55
from admin.admin import main_menu
6-
from admin.core.frontends.menus import AdminMenuSection
6+
from admin.core.frontends.menus import MenuSection
77

88
# Included Plugin
9-
from .blocks.base import BlockCommAdminCommand
9+
from .blocks.base import BlockCommMenuCommand
1010
from .blocks.chat import (
1111
block_chat_feature, blocked_chat_user_manager, unblock_any_chat_feature,
12-
unblock_my_chat_feature, UnblockAnyChatAdminCommand,
13-
UnblockMyChatAdminCommand)
12+
unblock_my_chat_feature, UnblockAnyChatMenuCommand,
13+
UnblockMyChatMenuCommand)
1414
from .blocks.voice import (
1515
block_voice_feature, blocked_voice_user_manager, unblock_any_voice_feature,
16-
unblock_my_voice_feature, UnblockAnyVoiceAdminCommand,
17-
UnblockMyVoiceAdminCommand)
16+
unblock_my_voice_feature, UnblockAnyVoiceMenuCommand,
17+
UnblockMyVoiceMenuCommand)
1818
from .strings import plugin_strings
1919

2020

2121
# =============================================================================
2222
# >> MENU ENTRIES
2323
# =============================================================================
24-
menu_section = main_menu.add_entry(AdminMenuSection(
24+
menu_section = main_menu.add_entry(MenuSection(
2525
main_menu, plugin_strings['section_title main']))
2626

27-
menu_section_chat = menu_section.add_entry(AdminMenuSection(
27+
menu_section_chat = menu_section.add_entry(MenuSection(
2828
menu_section, plugin_strings['section_title chat']))
2929

30-
menu_section_voice = menu_section.add_entry(AdminMenuSection(
30+
menu_section_voice = menu_section.add_entry(MenuSection(
3131
menu_section, plugin_strings['section_title voice']))
3232

33-
menu_section_chat.add_entry(BlockCommAdminCommand(
33+
menu_section_chat.add_entry(BlockCommMenuCommand(
3434
block_chat_feature,
3535
menu_section_chat,
3636
plugin_strings['popup_title block_chat']))
3737

38-
menu_section_voice.add_entry(BlockCommAdminCommand(
38+
menu_section_voice.add_entry(BlockCommMenuCommand(
3939
block_voice_feature,
4040
menu_section_voice,
4141
plugin_strings['popup_title block_voice']))
4242

43-
menu_section_chat.add_entry(UnblockAnyChatAdminCommand(
43+
menu_section_chat.add_entry(UnblockAnyChatMenuCommand(
4444
unblock_any_chat_feature,
4545
menu_section_chat,
4646
plugin_strings['popup_title unblock_chat_any']))
4747

48-
menu_section_voice.add_entry(UnblockAnyVoiceAdminCommand(
48+
menu_section_voice.add_entry(UnblockAnyVoiceMenuCommand(
4949
unblock_any_voice_feature,
5050
menu_section_voice,
5151
plugin_strings['popup_title unblock_voice_any']))
5252

53-
menu_section_chat.add_entry(UnblockMyChatAdminCommand(
53+
menu_section_chat.add_entry(UnblockMyChatMenuCommand(
5454
unblock_my_chat_feature,
5555
menu_section_chat,
5656
plugin_strings['popup_title unblock_chat']))
5757

58-
menu_section_voice.add_entry(UnblockMyVoiceAdminCommand(
58+
menu_section_voice.add_entry(UnblockMyVoiceMenuCommand(
5959
unblock_my_voice_feature,
6060
menu_section_voice,
6161
plugin_strings['popup_title unblock_voice']))

srcds/addons/source-python/plugins/admin/plugins/included/admin_comm_management/blocks/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Source.Python Admin
1818
from admin.core.clients import clients
1919
from admin.core.features import BaseFeature
20-
from admin.core.frontends.menus import AdminCommand, PlayerBasedAdminCommand
20+
from admin.core.frontends.menus import MenuCommand, PlayerBasedMenuCommand
2121
from admin.core.helpers import format_player_name
2222
from admin.core.orm import SessionContext
2323
from admin.core.paths import ADMIN_CFG_PATH, get_server_file
@@ -252,7 +252,7 @@ def filter(self, client, player):
252252
return not another_client.has_permission(self.flag)
253253

254254

255-
class BlockCommAdminCommand(PlayerBasedAdminCommand):
255+
class BlockCommMenuCommand(PlayerBasedMenuCommand):
256256
base_filter = 'human'
257257

258258
def __init__(self, feature, parent, title, id_=None):
@@ -299,7 +299,7 @@ def execute(self, client, blocked_comm_user_info):
299299
).start()
300300

301301

302-
class _UnblockCommAdminCommand(AdminCommand):
302+
class _UnblockCommMenuCommand(MenuCommand):
303303
popup_title = None
304304

305305
def __init__(self, feature, parent, title, id_=None):
@@ -344,12 +344,12 @@ def select(self, client):
344344
client.send_popup(self.popup)
345345

346346

347-
class UnblockAnyCommAdminCommand(_UnblockCommAdminCommand):
347+
class UnblockAnyCommMenuCommand(_UnblockCommMenuCommand):
348348
def _get_blocks(self, client):
349349
return self.feature.blocked_comm_user_manager.get_active_blocks()
350350

351351

352-
class UnblockMyCommAdminCommand(_UnblockCommAdminCommand):
352+
class UnblockMyCommMenuCommand(_UnblockCommMenuCommand):
353353
def _get_blocks(self, client):
354354
return self.feature.blocked_comm_user_manager.get_active_blocks(
355355
blocked_by=client.steamid)

srcds/addons/source-python/plugins/admin/plugins/included/admin_comm_management/blocks/chat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from ..models import BlockedChatUser
1414
from ..strings import plugin_strings
1515
from .base import (
16-
BlockCommFeature, BlockedCommUserManager, UnblockAnyCommAdminCommand,
17-
UnblockCommFeature, UnblockMyCommAdminCommand)
16+
BlockCommFeature, BlockedCommUserManager, UnblockAnyCommMenuCommand,
17+
UnblockCommFeature, UnblockMyCommMenuCommand)
1818

1919

2020
# =============================================================================
@@ -70,11 +70,11 @@ class _UnblockMyChatFeature(_UnblockChatFeature):
7070
unblock_my_chat_feature = _UnblockMyChatFeature()
7171

7272

73-
class UnblockAnyChatAdminCommand(UnblockAnyCommAdminCommand):
73+
class UnblockAnyChatMenuCommand(UnblockAnyCommMenuCommand):
7474
popup_title = plugin_strings['popup_title unblock_chat_any']
7575

7676

77-
class UnblockMyChatAdminCommand(UnblockMyCommAdminCommand):
77+
class UnblockMyChatMenuCommand(UnblockMyCommMenuCommand):
7878
popup_title = plugin_strings['popup_title unblock_chat']
7979

8080

srcds/addons/source-python/plugins/admin/plugins/included/admin_comm_management/blocks/voice.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from ..models import BlockedVoiceUser
1616
from ..strings import plugin_strings
1717
from .base import (
18-
BlockCommFeature, BlockedCommUserManager, UnblockAnyCommAdminCommand,
19-
UnblockCommFeature, UnblockMyCommAdminCommand)
18+
BlockCommFeature, BlockedCommUserManager, UnblockAnyCommMenuCommand,
19+
UnblockCommFeature, UnblockMyCommMenuCommand)
2020

2121

2222
# =============================================================================
@@ -95,11 +95,11 @@ class _UnblockMyVoiceFeature(_UnblockVoiceFeature):
9595
unblock_my_voice_feature = _UnblockMyVoiceFeature()
9696

9797

98-
class UnblockAnyVoiceAdminCommand(UnblockAnyCommAdminCommand):
98+
class UnblockAnyVoiceMenuCommand(UnblockAnyCommMenuCommand):
9999
popup_title = plugin_strings['popup_title unblock_voice_any']
100100

101101

102-
class UnblockMyVoiceAdminCommand(UnblockMyCommAdminCommand):
102+
class UnblockMyVoiceMenuCommand(UnblockMyCommMenuCommand):
103103
popup_title = plugin_strings['popup_title unblock_voice']
104104

105105

srcds/addons/source-python/plugins/admin/plugins/included/admin_kick_ban/admin_kick_ban.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from admin.admin import main_menu
99
from admin.core.features import PlayerBasedFeature
1010
from admin.core.frontends.menus import (
11-
AdminCommand, AdminMenuSection, PlayerBasedAdminCommand)
11+
MenuCommand, MenuSection, PlayerBasedMenuCommand)
1212
from admin.core.frontends.motd import (
1313
main_motd, MOTDSection, MOTDPageEntry, PlayerBasedFeaturePage)
1414
from admin.core.helpers import log_admin_action
@@ -51,7 +51,7 @@ def execute(self, client, player):
5151
kick_feature = _KickFeature()
5252

5353

54-
class _KickMenuCommand(PlayerBasedAdminCommand):
54+
class _KickMenuCommand(PlayerBasedMenuCommand):
5555
allow_multiple_choices = False
5656

5757

@@ -68,13 +68,13 @@ class _KickPage(PlayerBasedFeaturePage):
6868
# =============================================================================
6969
# >> MENU ENTRIES
7070
# =============================================================================
71-
menu_section = main_menu.add_entry(AdminMenuSection(
71+
menu_section = main_menu.add_entry(MenuSection(
7272
main_menu, plugin_strings['section_title main']))
7373

74-
menu_section_steamid = menu_section.add_entry(AdminMenuSection(
74+
menu_section_steamid = menu_section.add_entry(MenuSection(
7575
menu_section, plugin_strings['section_title steamid_bans']))
7676

77-
menu_section_ip_address = menu_section.add_entry(AdminMenuSection(
77+
menu_section_ip_address = menu_section.add_entry(MenuSection(
7878
menu_section, plugin_strings['section_title ip_address_bans']))
7979

8080
lift_steamid_ban_popup_feature.ban_popup.parent_menu = (
@@ -105,42 +105,42 @@ class _KickPage(PlayerBasedFeaturePage):
105105
menu_section_ip_address,
106106
plugin_strings['popup_title ban_ip_address']))
107107

108-
menu_section_steamid.add_entry(AdminCommand(
108+
menu_section_steamid.add_entry(MenuCommand(
109109
review_steamid_ban_popup_feature,
110110
menu_section_steamid,
111111
plugin_strings['popup_title review_steamid']))
112112

113-
menu_section_ip_address.add_entry(AdminCommand(
113+
menu_section_ip_address.add_entry(MenuCommand(
114114
review_ip_address_ban_popup_feature,
115115
menu_section_ip_address,
116116
plugin_strings['popup_title review_ip_address']))
117117

118-
menu_section_steamid.add_entry(AdminCommand(
118+
menu_section_steamid.add_entry(MenuCommand(
119119
lift_steamid_ban_popup_feature,
120120
menu_section_steamid,
121121
plugin_strings['popup_title lift_steamid']))
122122

123-
menu_section_ip_address.add_entry(AdminCommand(
123+
menu_section_ip_address.add_entry(MenuCommand(
124124
lift_ip_address_ban_popup_feature,
125125
menu_section_ip_address,
126126
plugin_strings['popup_title lift_ip_address']))
127127

128-
menu_section_steamid.add_entry(AdminCommand(
128+
menu_section_steamid.add_entry(MenuCommand(
129129
lift_any_steamid_ban_popup_feature,
130130
menu_section_steamid,
131131
plugin_strings['popup_title lift_reviewed_steamid']))
132132

133-
menu_section_ip_address.add_entry(AdminCommand(
133+
menu_section_ip_address.add_entry(MenuCommand(
134134
lift_any_ip_address_ban_popup_feature,
135135
menu_section_ip_address,
136136
plugin_strings['popup_title lift_reviewed_ip_address']))
137137

138-
menu_section_steamid.add_entry(AdminCommand(
138+
menu_section_steamid.add_entry(MenuCommand(
139139
search_bad_steamid_bans_popup_feature,
140140
menu_section_steamid,
141141
plugin_strings['popup_title search_bad_bans']))
142142

143-
menu_section_ip_address.add_entry(AdminCommand(
143+
menu_section_ip_address.add_entry(MenuCommand(
144144
search_bad_ip_address_bans_popup_feature,
145145
menu_section_ip_address,
146146
plugin_strings['popup_title search_bad_bans']))

0 commit comments

Comments
 (0)