comparison sat_frontends/jp/cmd_bookmarks.py @ 4037:524856bd7b19

massive refactoring to switch from camelCase to snake_case: historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a pre-PEP8 code, to use the same coding style as in Twisted. However, snake_case is more readable and it's better to follow PEP8 best practices, so it has been decided to move on full snake_case. Because Libervia has a huge codebase, this ended with a ugly mix of camelCase and snake_case. To fix that, this patch does a big refactoring by renaming every function and method (including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case. This is a massive change, and may result in some bugs.
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:54:42 +0200
parents 04283582966f
children 4b842c1fb686
comparison
equal deleted inserted replaced
4036:c4464d7ae97b 4037:524856bd7b19
53 def __init__(self, host): 53 def __init__(self, host):
54 super(BookmarksList, self).__init__(host, "list", help=_("list bookmarks")) 54 super(BookmarksList, self).__init__(host, "list", help=_("list bookmarks"))
55 55
56 async def start(self): 56 async def start(self):
57 try: 57 try:
58 data = await self.host.bridge.bookmarksList( 58 data = await self.host.bridge.bookmarks_list(
59 self.args.type, self.args.location, self.host.profile 59 self.args.type, self.args.location, self.host.profile
60 ) 60 )
61 except Exception as e: 61 except Exception as e:
62 self.disp(f"can't get bookmarks list: {e}", error=True) 62 self.disp(f"can't get bookmarks list: {e}", error=True)
63 self.host.quit(C.EXIT_BRIDGE_ERRBACK) 63 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
105 help=_("delete bookmark without confirmation"), 105 help=_("delete bookmark without confirmation"),
106 ) 106 )
107 107
108 async def start(self): 108 async def start(self):
109 if not self.args.force: 109 if not self.args.force:
110 await self.host.confirmOrQuit(_("Are you sure to delete this bookmark?")) 110 await self.host.confirm_or_quit(_("Are you sure to delete this bookmark?"))
111 111
112 try: 112 try:
113 await self.host.bridge.bookmarksRemove( 113 await self.host.bridge.bookmarks_remove(
114 self.args.type, self.args.bookmark, self.args.location, self.host.profile 114 self.args.type, self.args.bookmark, self.args.location, self.host.profile
115 ) 115 )
116 except Exception as e: 116 except Exception as e:
117 self.disp(_("can't delete bookmark: {e}").format(e=e), error=True) 117 self.disp(_("can't delete bookmark: {e}").format(e=e), error=True)
118 self.host.quit(C.EXIT_BRIDGE_ERRBACK) 118 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
149 if self.args.nick is not None: 149 if self.args.nick is not None:
150 data["nick"] = self.args.nick 150 data["nick"] = self.args.nick
151 if self.args.name is not None: 151 if self.args.name is not None:
152 data["name"] = self.args.name 152 data["name"] = self.args.name
153 try: 153 try:
154 await self.host.bridge.bookmarksAdd( 154 await self.host.bridge.bookmarks_add(
155 self.args.type, 155 self.args.type,
156 self.args.bookmark, 156 self.args.bookmark,
157 data, 157 data,
158 self.args.location, 158 self.args.location,
159 self.host.profile, 159 self.host.profile,