Skip to content

Commit

Permalink
fix: marking, rundown primary asset
Browse files Browse the repository at this point in the history
  • Loading branch information
martastain committed May 8, 2023
1 parent ef92434 commit 5b2adfe
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
5 changes: 4 additions & 1 deletion firefly/components/input_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def __init__(self, parent, value=None, **kwargs):
self.clear_button.setText("Clear")
self.clear_button.clicked.connect(self.clear_value)
layout.addWidget(self.clear_button, 0)
else:
self.clear_button = None

self.setLayout(layout)
self.set_value(value)
Expand Down Expand Up @@ -91,4 +93,5 @@ def get_value(self):
def setReadOnly(self, value):
self._read_only = value
self.end_edit()
self.clear_button.setEnabled(not value)
if self.clear_button:
self.clear_button.setEnabled(not value)
3 changes: 2 additions & 1 deletion firefly/modules/rundown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ def set_channel(self, id_channel):

def on_channel_changed(self):
self.load(do_update_header=True)
self.plugins.load()
if self.plugins:
self.plugins.load()

if self.mcr:
self.mcr.on_channel_changed()
Expand Down
2 changes: 2 additions & 0 deletions firefly/modules/rundown/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def load_callback(self, response):
item.id_channel = self.id_channel
if row.get("id_asset"):
item._asset = asset_cache.get(row["id_asset"])
item._asset.meta.pop("mark_in", None)
item._asset.meta.pop("mark_out", None)
required_assets.append([row["id_asset"], row["asset_mtime"]])
else:
item._asset = None
Expand Down
21 changes: 21 additions & 0 deletions firefly/modules/rundown/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def contextMenuEvent(self, event):
action_split.triggered.connect(self.on_split)
menu.addAction(action_split)

action_set_primary = QAction("Set as primary", self)
action_set_primary.setStatusTip("Set selected item as primary")
action_set_primary.triggered.connect(self.on_set_primary)
menu.addAction(action_set_primary)

if obj_set[0] == "item" and (
self.selected_objects[0]["id_asset"]
or self.selected_objects[0]["item_role"] == "live"
Expand Down Expand Up @@ -331,6 +336,22 @@ def on_split(self):
)
self.model().load()

def on_set_primary(self):
item = self.selected_objects[0]
asset = item._asset
if not asset:
return

emeta = {}
for field in self.playout_config.fields:
key = field.name
if key in asset.meta:
emeta[key] = asset.meta[key]
emeta["id_asset"] = asset.id

api.set(object_type="event", id=item["id_event"], data=emeta)
self.model().load()

def on_solve(self, solver):
QApplication.processEvents()
QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor)
Expand Down
2 changes: 2 additions & 0 deletions firefly/modules/scheduler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def focus(self, objects):
# self.calendar.update()

def open_rundown(self, ts, event=False):
if not self.main_window.main_widget.rundown:
return
self.main_window.main_widget.rundown.load(start_time=ts, event=event)
self.main_window.main_widget.switch_tab(
self.main_window.main_widget.rundown, perform_on_switch_tab=False
Expand Down
3 changes: 3 additions & 0 deletions firefly/objects/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ def foreground(self, obj, **kwargs):
def font(self, obj, **kwargs):
if obj.object_type == "event":
return "bold"
elif obj.object_type == "item":
if obj.get("is_primary"):
return "bold"


format_helpers_list = [
Expand Down

0 comments on commit 5b2adfe

Please sign in to comment.