Skip to content

Commit

Permalink
Fix some sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvladus committed Oct 22, 2023
1 parent 4085ba6 commit 8a27882
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
8 changes: 8 additions & 0 deletions data/io.github.mrvladus.List.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
</screenshot>
</screenshots>
<releases>
<release version="45.0.3" date="2023-10-22">
<description translatable="no">
<p>Fixed:</p>
<ul>
<li>Bug when all sub-tasks becomes unfinished when new sub-task added or moved.</li>
</ul>
</description>
</release>
<release version="45.0.2" date="2023-10-19">
<description translatable="no">
<p>Fixed:</p>
Expand Down
18 changes: 9 additions & 9 deletions errands/utils/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def _connect(self) -> bool:
url=self.url, username=self.username, password=self.password
) as client:
try:
principal: Principal = client.principal()
self.principal: Principal = client.principal()
Log.info(f"Connected to {self.name} server at '{self.url}'")
self.can_sync = True
self._setup_calendar(principal)
self._setup_calendar(self.principal)
self.window.sync_btn.set_visible(True)
except:
Log.error(f"Can't connect to {self.name} server at '{self.url}'")
Expand Down Expand Up @@ -145,7 +145,7 @@ def _get_tasks(self) -> list[dict]:
return tasks
except:
Log.error(f"Can't get tasks from {self.name}")
return None
return []

def _fetch(self):
"""
Expand Down Expand Up @@ -205,8 +205,8 @@ def _fetch(self):

UserData.set(data)

def _setup_calendar(self, principal: Principal) -> None:
calendars: list[Calendar] = principal.calendars()
def _setup_calendar(self) -> None:
calendars: list[Calendar] = self.principal.calendars()
cal_name: str = GSettings.get("sync-cal-name")
cal_exists: bool = False
errands_cal_exists: bool = False
Expand All @@ -219,21 +219,21 @@ def _setup_calendar(self, principal: Principal) -> None:
errands_cal_exists = True
if not cal_exists and cal_name != "":
Log.debug(f"Create new calendar '{cal_name}' on {self.name}")
self.calendar = principal.make_calendar(
self.calendar = self.principal.make_calendar(
cal_name, supported_calendar_component_set=["VTODO"]
)
if not errands_cal_exists and cal_name == "":
Log.debug(f"Create new calendar 'Errands' on {self.name}")
self.calendar = principal.make_calendar(
self.calendar = self.principal.make_calendar(
"Errands", supported_calendar_component_set=["VTODO"]
)

def sync(self, fetch: bool) -> None:
"""
Sync local tasks with provider
"""

caldav_tasks: list[dict] | None = self._get_tasks()
# self._setup_calendar()
caldav_tasks: list[dict] = self._get_tasks()

Log.info(f"Sync tasks with {self.name}")

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project(
'errands',
version: '45.0.2',
version: '45.0.3',
meson_version: '>= 0.62.0',
)

Expand Down

0 comments on commit 8a27882

Please sign in to comment.