Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Py Organiser #319

Merged
merged 11 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Bug fix
  • Loading branch information
swaroopmaddu committed Oct 4, 2020
commit 3edbe6ad89e9318eafc8fffca783e6df4d18815d
2 changes: 1 addition & 1 deletion Scripts/Miscellaneous/PyOrganiser/data.db
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{"18-05-2020": [{"name": null, "todos": []}]}
15 changes: 6 additions & 9 deletions Scripts/Miscellaneous/PyOrganiser/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import sys
import json
import PyQt5
import PyQt5.QtCore
from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt5.QtCore import Qt

Expand All @@ -27,10 +25,9 @@ def data(self, index, role):
status, _ = self.todos[index.row()]
if status:
return tick
else:
return untick
return untick

def rowCount(self, index):
def rowCount(self,index):
return len(self.todos)


Expand Down Expand Up @@ -81,7 +78,7 @@ def complete(self):
if indexes:
index = indexes[0]
row = index.row()
status, text = self.model.todos[row]
text = self.model.todos[row][1]
self.model.todos[row] = (True, text)
# .dataChanged takes top-left and bottom right, which are equal
# for a single selection.
Expand All @@ -96,7 +93,7 @@ def incomplete(self):
if indexes:
index = indexes[0]
row = index.row()
status, text = self.model.todos[row]
text = self.model.todos[row][1]
self.model.todos[row] = (False, text)
# .dataChanged takes top-left and bottom right, which are equal
# for a single selection.
Expand Down Expand Up @@ -126,7 +123,7 @@ def load(self):
jsondata = json.load(f)
try:
k = jsondata[self.date][0]
except KeyError as ke:
except KeyError :
jsondata[self.date] = [{'name': None, 'todos': []}]
k = jsondata[self.date][0]
self.model.database = jsondata
Expand All @@ -138,7 +135,7 @@ def load(self):

def save(self):
with open('data.db', 'w') as f:
data = json.dump(self.model.database, f)
json.dump(self.model.database, f)


app = QtWidgets.QApplication(sys.argv)
Expand Down