moving from category to project
This commit is contained in:
parent
fa1534e083
commit
3c422f363a
@ -39,6 +39,7 @@ class Task(BaseModel):
|
||||
due = DateTimeField(null=True)
|
||||
category = ForeignKeyField(Category, backref="tasks", null=True)
|
||||
type = CharField()
|
||||
project = CharField()
|
||||
created_at = DateTimeField(default=datetime.now)
|
||||
updated_at = DateTimeField(default=datetime.now)
|
||||
deleted = BooleanField(default=False)
|
||||
|
@ -71,7 +71,7 @@ class EnumColumnConfig(TableColumnConfig):
|
||||
raise NotifyValidationError(f"Invalid value {val}. Use: {list(self.enum)}")
|
||||
|
||||
def format_for_display(self, val):
|
||||
return get_color_enum(val, self.enum, "red")
|
||||
return get_color_enum(val, self.enum)
|
||||
|
||||
|
||||
def start_change(self, app, current_value):
|
||||
|
@ -61,7 +61,7 @@ class ChoiceModal(ModalScreen):
|
||||
yield RadioSet(
|
||||
*[
|
||||
RadioButton(
|
||||
get_color_enum(e.value, config.STATUSES, "red"), value=self.selected == str(e.value)
|
||||
get_color_enum(e.value, config.STATUSES), value=self.selected == str(e.value)
|
||||
)
|
||||
for e in self._enum
|
||||
]
|
||||
|
@ -87,7 +87,3 @@ class TT(TableEditor):
|
||||
def run(default_view):
|
||||
app = TT(default_view)
|
||||
app.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
|
@ -32,18 +32,11 @@ def advance_enum_val(enum_type, cur_val):
|
||||
return members[next_idx]
|
||||
|
||||
|
||||
def get_color_enum(value: str, enum: dict[str, dict], default: str) -> str:
|
||||
color = enum.get(value, {"color": default})["color"]
|
||||
def get_color_enum(value: str, enum: dict[str, dict]) -> str:
|
||||
color = enum.get(value, {"color": "#ff0000"})["color"]
|
||||
return f"[{color}]{value}[/]"
|
||||
|
||||
|
||||
def get_colored_category(category: str) -> str:
|
||||
hash_val = sum(ord(c) for c in category)
|
||||
hue = hash_val % 360
|
||||
color = f"rgb({hue},200,200) on default"
|
||||
return f"[{color}]{category}[/]"
|
||||
|
||||
|
||||
def get_colored_date(date: datetime.date) -> str:
|
||||
if not isinstance(date, datetime.date):
|
||||
return ""
|
||||
|
Loading…
Reference in New Issue
Block a user