Skip to content

Commit 14b4a4a

Browse files
committed
cleanup
1 parent 3ba0125 commit 14b4a4a

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Mergin/plugin.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -923,15 +923,17 @@ def createChildrenProjects(self):
923923
error = self.fetch_projects()
924924
if error is not None:
925925
return error
926-
print("self.plugin.current_workspace['name']", self.plugin.current_workspace['name'])
927926
if not self.local_projects:
928-
self.local_projects = [ { "namespace": i[1], "name": i[2] } for i in get_local_mergin_projects_info( self.plugin.current_workspace['name'] ) ]
927+
self.local_projects = [
928+
{"namespace": i[1], "name": i[2]}
929+
for i in get_local_mergin_projects_info(self.plugin.current_workspace["name"])
930+
]
929931
items = []
930932

931933
for project in self.local_projects:
932934
item = MerginLocalProjectItem(self, project, self.project_manager)
933935
sip.transferto(item, self)
934-
items.append( item )
936+
items.append(item)
935937
for project in self.projects:
936938
project_name = posixpath.join(project["namespace"], project["name"]) # posix path for server API calls
937939
local_proj_path = mergin_project_local_path(project_name)
@@ -971,11 +973,11 @@ def fetch_projects(self, page=1, per_page=PROJS_PER_PAGE):
971973
self.total_projects_count = int(resp["count"]) if is_number(resp["count"]) else 0
972974

973975
# Sometimes we fetched a local, recursivly fetch until we fetched enougth at the same time
974-
set_fetched_projects = set( [i["name"] for i in resp["projects"]] )
975-
set_local_projects = set( [i["name"] for i in self.local_projects] )
976+
set_fetched_projects = set([i["name"] for i in resp["projects"]])
977+
set_local_projects = set([i["name"] for i in self.local_projects])
976978

977979
new_projs_per_page_left = per_page - len(set_fetched_projects - set_local_projects)
978-
if new_projs_per_page_left != 0 and len(self.projects) < self.total_projects_count :
980+
if new_projs_per_page_left != 0 and len(self.projects) < self.total_projects_count:
979981
new_page_to_get = floor(len(self.projects) / new_projs_per_page_left) + 1
980982
self.fetch_projects(new_page_to_get, per_page=new_projs_per_page_left)
981983

@@ -1017,7 +1019,10 @@ def reload(self):
10171019
self.plugin.choose_active_workspace()
10181020

10191021
self.projects = []
1020-
self.local_projects = [ { "namespace": i[1], "name": i[2] } for i in get_local_mergin_projects_info( self.plugin.current_workspace["name"] ) ]
1022+
self.local_projects = [
1023+
{"namespace": i[1], "name": i[2]}
1024+
for i in get_local_mergin_projects_info(self.plugin.current_workspace["name"])
1025+
]
10211026
self.refresh()
10221027

10231028
def new_project(self):

Mergin/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ def pretty_summary(summary):
985985
def get_local_mergin_projects_info(workspace=None):
986986
"""
987987
Get a list of local Mergin Maps projects info from QSettings.
988-
if workspace is specified only the one
988+
if workspace is specified only the one
989989
"""
990990
local_projects_info = []
991991
settings = QSettings()
@@ -1000,7 +1000,7 @@ def get_local_mergin_projects_info(workspace=None):
10001000
if len(key_parts) > 2 and key_parts[2] == "path":
10011001
# print("debug", key_parts[0], workspace)
10021002
if workspace != None and key_parts[0] != workspace:
1003-
continue
1003+
continue
10041004

10051005
local_path = settings.value(key, None)
10061006
# double check if the path exists - it might get deleted manually

0 commit comments

Comments
 (0)