|
|
@ -23,9 +23,9 @@ class ShowDetailsScreen(Screen):
|
|
|
|
CSS = """
|
|
|
|
CSS = """
|
|
|
|
|
|
|
|
|
|
|
|
Grid {
|
|
|
|
Grid {
|
|
|
|
grid-size: 2 14;
|
|
|
|
grid-size: 5 14;
|
|
|
|
grid-rows: 2 2 2 2 2 2 2 2 2 2 2 6 2 2;
|
|
|
|
grid-rows: 2 2 2 2 2 2 2 2 2 2 2 6 2 2;
|
|
|
|
grid-columns: 30 90;
|
|
|
|
grid-columns: 30 30 30 30 30;
|
|
|
|
height: 100%;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
padding: 1;
|
|
|
|
padding: 1;
|
|
|
@ -50,6 +50,15 @@ class ShowDetailsScreen(Screen):
|
|
|
|
.two {
|
|
|
|
.two {
|
|
|
|
column-span: 2;
|
|
|
|
column-span: 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.three {
|
|
|
|
|
|
|
|
column-span: 3;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.four {
|
|
|
|
|
|
|
|
column-span: 4;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.five {
|
|
|
|
|
|
|
|
column-span: 5;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.box {
|
|
|
|
.box {
|
|
|
|
height: 100%;
|
|
|
|
height: 100%;
|
|
|
@ -114,7 +123,7 @@ class ShowDetailsScreen(Screen):
|
|
|
|
self.query_one("#indicator_episode_digits_input", Input).value = "2"
|
|
|
|
self.query_one("#indicator_episode_digits_input", Input).value = "2"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getSelectedPattern(self):
|
|
|
|
def getSelectedPatternDescriptor(self):
|
|
|
|
|
|
|
|
|
|
|
|
selectedPattern = {}
|
|
|
|
selectedPattern = {}
|
|
|
|
|
|
|
|
|
|
|
@ -127,6 +136,7 @@ class ShowDetailsScreen(Screen):
|
|
|
|
if row_key is not None:
|
|
|
|
if row_key is not None:
|
|
|
|
selected_row_data = self.patternTable.get_row(row_key)
|
|
|
|
selected_row_data = self.patternTable.get_row(row_key)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectedPattern['show_id'] = self.show_obj['id']
|
|
|
|
selectedPattern['pattern'] = str(selected_row_data[0])
|
|
|
|
selectedPattern['pattern'] = str(selected_row_data[0])
|
|
|
|
|
|
|
|
|
|
|
|
except CellDoesNotExist:
|
|
|
|
except CellDoesNotExist:
|
|
|
@ -140,7 +150,7 @@ class ShowDetailsScreen(Screen):
|
|
|
|
|
|
|
|
|
|
|
|
def action_add_pattern(self):
|
|
|
|
def action_add_pattern(self):
|
|
|
|
if self.show_obj:
|
|
|
|
if self.show_obj:
|
|
|
|
self.app.push_screen(PatternDetailsScreen(showId = self.show_obj['id']), self.handle_add_pattern)
|
|
|
|
self.app.push_screen(PatternDetailsScreen(showId = self.show_obj['id']), self.handle_add_pattern) # <-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_add_pattern(self, screenResult):
|
|
|
|
def handle_add_pattern(self, screenResult):
|
|
|
@ -151,31 +161,36 @@ class ShowDetailsScreen(Screen):
|
|
|
|
|
|
|
|
|
|
|
|
def action_edit_pattern(self):
|
|
|
|
def action_edit_pattern(self):
|
|
|
|
|
|
|
|
|
|
|
|
selectedPattern = self.getSelectedPattern()
|
|
|
|
selectedPatternDescriptor = self.getSelectedPatternDescriptor()
|
|
|
|
|
|
|
|
|
|
|
|
if selectedPattern:
|
|
|
|
if selectedPatternDescriptor:
|
|
|
|
|
|
|
|
|
|
|
|
selectedPatternId = self.__pc.findPattern(self.show_obj['id'], selectedPattern['pattern'])
|
|
|
|
selectedPatternId = self.__pc.findPattern(selectedPatternDescriptor)
|
|
|
|
|
|
|
|
|
|
|
|
if selectedPatternId is None:
|
|
|
|
if selectedPatternId is None:
|
|
|
|
raise click.ClickException(f"ShowDetailsScreen.action_edit_pattern(): Pattern to remove has no id")
|
|
|
|
raise click.ClickException(f"ShowDetailsScreen.action_edit_pattern(): Pattern to remove has no id")
|
|
|
|
|
|
|
|
|
|
|
|
self.app.push_screen(PatternDetailsScreen(patternId = selectedPatternId, showId = self.show_obj['id']), self.handle_edit_pattern)
|
|
|
|
self.app.push_screen(PatternDetailsScreen(patternId = selectedPatternId, showId = self.show_obj['id']), self.handle_edit_pattern) # <-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_edit_pattern(self, screenResult):
|
|
|
|
def handle_edit_pattern(self, screenResult):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
row_key, col_key = self.patternTable.coordinate_to_cell_key(self.patternTable.cursor_coordinate)
|
|
|
|
|
|
|
|
self.patternTable.update_cell(row_key, self.column_key_pattern, screenResult['pattern'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except CellDoesNotExist:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
#pattern = (screenResult['pattern'],)
|
|
|
|
|
|
|
|
#self.patternTable.add_row(*map(str, pattern))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def action_remove_pattern(self):
|
|
|
|
def action_remove_pattern(self):
|
|
|
|
|
|
|
|
|
|
|
|
selectedPattern = self.getSelectedPattern()
|
|
|
|
selectedPatternDescriptor = self.getSelectedPatternDescriptor()
|
|
|
|
|
|
|
|
|
|
|
|
if selectedPattern:
|
|
|
|
if selectedPatternDescriptor:
|
|
|
|
|
|
|
|
|
|
|
|
selectedPatternId = self.__pc.findPattern(self.show_obj['id'], selectedPattern['pattern'])
|
|
|
|
selectedPatternId = self.__pc.findPattern(selectedPatternDescriptor)
|
|
|
|
|
|
|
|
|
|
|
|
if selectedPatternId is None:
|
|
|
|
if selectedPatternId is None:
|
|
|
|
raise click.ClickException(f"ShowDetailsScreen.action_remove_pattern(): Pattern to remove has no id")
|
|
|
|
raise click.ClickException(f"ShowDetailsScreen.action_remove_pattern(): Pattern to remove has no id")
|
|
|
@ -196,10 +211,10 @@ class ShowDetailsScreen(Screen):
|
|
|
|
def compose(self):
|
|
|
|
def compose(self):
|
|
|
|
|
|
|
|
|
|
|
|
# Create the DataTable widget
|
|
|
|
# Create the DataTable widget
|
|
|
|
self.patternTable = DataTable(classes="two")
|
|
|
|
self.patternTable = DataTable(classes="five")
|
|
|
|
|
|
|
|
|
|
|
|
# Define the columns with headers
|
|
|
|
# Define the columns with headers
|
|
|
|
self.column_key_id = self.patternTable.add_column("Pattern", width=90)
|
|
|
|
self.column_key_pattern = self.patternTable.add_column("Pattern", width=150)
|
|
|
|
#self.column_key_name = self.patternTable.add_column("Name", width=50)
|
|
|
|
#self.column_key_name = self.patternTable.add_column("Name", width=50)
|
|
|
|
#self.column_key_year = self.patternTable.add_column("Year", width=10)
|
|
|
|
#self.column_key_year = self.patternTable.add_column("Year", width=10)
|
|
|
|
|
|
|
|
|
|
|
@ -211,52 +226,52 @@ class ShowDetailsScreen(Screen):
|
|
|
|
with Grid():
|
|
|
|
with Grid():
|
|
|
|
|
|
|
|
|
|
|
|
# 1
|
|
|
|
# 1
|
|
|
|
yield Static("Show" if self.show_obj else "New Show", id="toplabel", classes="two")
|
|
|
|
yield Static("Show" if self.show_obj else "New Show", id="toplabel", classes="five")
|
|
|
|
|
|
|
|
|
|
|
|
# 2
|
|
|
|
# 2
|
|
|
|
yield Static("ID")
|
|
|
|
yield Static("ID")
|
|
|
|
if self.show_obj:
|
|
|
|
if self.show_obj:
|
|
|
|
yield Static("", id="id_wdg")
|
|
|
|
yield Static("", id="id_wdg", classes="four")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
yield Input(type="integer", id="id_wdg")
|
|
|
|
yield Input(type="integer", id="id_wdg", classes="four")
|
|
|
|
|
|
|
|
|
|
|
|
# 3
|
|
|
|
# 3
|
|
|
|
yield Static("Name")
|
|
|
|
yield Static("Name")
|
|
|
|
yield Input(type="text", id="name_input")
|
|
|
|
yield Input(type="text", id="name_input", classes="four")
|
|
|
|
|
|
|
|
|
|
|
|
# 4
|
|
|
|
# 4
|
|
|
|
yield Static("Year")
|
|
|
|
yield Static("Year")
|
|
|
|
yield Input(type="integer", id="year_input")
|
|
|
|
yield Input(type="integer", id="year_input", classes="four")
|
|
|
|
|
|
|
|
|
|
|
|
#5
|
|
|
|
#5
|
|
|
|
yield Static(" ", classes="two")
|
|
|
|
yield Static(" ", classes="five")
|
|
|
|
|
|
|
|
|
|
|
|
#6
|
|
|
|
#6
|
|
|
|
yield Static("Index Season Digits")
|
|
|
|
yield Static("Index Season Digits")
|
|
|
|
yield Input(type="integer", id="index_season_digits_input")
|
|
|
|
yield Input(type="integer", id="index_season_digits_input", classes="four")
|
|
|
|
|
|
|
|
|
|
|
|
#7
|
|
|
|
#7
|
|
|
|
yield Static("Index Episode Digits")
|
|
|
|
yield Static("Index Episode Digits")
|
|
|
|
yield Input(type="integer", id="index_episode_digits_input")
|
|
|
|
yield Input(type="integer", id="index_episode_digits_input", classes="four")
|
|
|
|
|
|
|
|
|
|
|
|
#8
|
|
|
|
#8
|
|
|
|
yield Static("Indicator Season Digits")
|
|
|
|
yield Static("Indicator Season Digits")
|
|
|
|
yield Input(type="integer", id="indicator_season_digits_input")
|
|
|
|
yield Input(type="integer", id="indicator_season_digits_input", classes="four")
|
|
|
|
|
|
|
|
|
|
|
|
#9
|
|
|
|
#9
|
|
|
|
yield Static("Indicator Edisode Digits")
|
|
|
|
yield Static("Indicator Edisode Digits")
|
|
|
|
yield Input(type="integer", id="indicator_episode_digits_input")
|
|
|
|
yield Input(type="integer", id="indicator_episode_digits_input", classes="four")
|
|
|
|
|
|
|
|
|
|
|
|
# 10
|
|
|
|
# 10
|
|
|
|
yield Static(" ", classes="two")
|
|
|
|
yield Static(" ", classes="five")
|
|
|
|
|
|
|
|
|
|
|
|
# 11
|
|
|
|
# 11
|
|
|
|
yield Static("File patterns", classes="two")
|
|
|
|
yield Static("File patterns", classes="five")
|
|
|
|
# 12
|
|
|
|
# 12
|
|
|
|
yield self.patternTable
|
|
|
|
yield self.patternTable
|
|
|
|
|
|
|
|
|
|
|
|
# 13
|
|
|
|
# 13
|
|
|
|
yield Static(" ", classes="two")
|
|
|
|
yield Static(" ", classes="five")
|
|
|
|
|
|
|
|
|
|
|
|
# 14
|
|
|
|
# 14
|
|
|
|
yield Button("Save", id="save_button")
|
|
|
|
yield Button("Save", id="save_button")
|
|
|
|