Skip to content

Commit

Permalink
Updated to 5.32.2
Browse files Browse the repository at this point in the history
  • Loading branch information
martastain committed Sep 3, 2021
1 parent 51ad55e commit 82e930c
Show file tree
Hide file tree
Showing 29 changed files with 271 additions and 230 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ following command:
sudo pip3 install PyQT5 websocket-client
```

For video playback, you will also need **libmpv1** package.
The following packages are also needed, in case you don't have them already installed,
run `sudo apt install libmpv1 libxcb-util1` on Ubuntu or `sudo apt install libmpv1 libxcb-util0` on Debian.

### Windows

Expand All @@ -35,8 +36,8 @@ Edit **settings.json** file to set your server address and site name.
```json
{
"sites" : [{
"site_name" : "nebulatv",
"hub" : "https://nebulatv.example.com"
"site_name" : "nebula",
"hub" : "https://nebula.example.com"
}]
}
```
Expand Down
2 changes: 1 addition & 1 deletion firefly/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run(self, method, callback, **kwargs):
)
request.setHeader(
QNetworkRequest.UserAgentHeader,
QVariant("nebula-firefly/{}".format(FIREFLY_VERSION))
QVariant(f"nebula-firefly/{FIREFLY_VERSION}")
)

try:
Expand Down
13 changes: 4 additions & 9 deletions firefly/application.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import sys
import locale
import copy

from pprint import pprint

from .common import *
from .filesystem import load_filesystem
Expand All @@ -25,7 +22,7 @@ def check_login(wnd):
if data["response"] > 403:
QMessageBox.critical(
wnd,
"Error {}".format(data["response"]),
f"Error {data['response']}",
data["message"]
)
return False
Expand All @@ -34,9 +31,7 @@ def check_login(wnd):

class FireflyApplication(Application):
def __init__(self, **kwargs):
title = "Firefly {}".format(FIREFLY_VERSION)
if FIREFLY_STATUS:
title += " " + FIREFLY_STATUS
title = f"Firefly {FIREFLY_VERSION}"
super(FireflyApplication, self).__init__(name="firefly", title=title)
locale.setlocale(locale.LC_NUMERIC, 'C')
self.splash = QSplashScreen(pix_lib['splash'])
Expand All @@ -55,8 +50,8 @@ def __init__(self, **kwargs):
config.update(config["sites"][i])
del(config["sites"])

self.app_state_path = os.path.join(app_dir, "ffdata.{}.appstate".format(config["site_name"]))
self.auth_key_path = os.path.join(app_dir, "ffdata.{}.key".format(config["site_name"]))
self.app_state_path = os.path.join(app_dir, f"ffdata.{config['site_name']}.appstate")
self.auth_key_path = os.path.join(app_dir, f"ffdata.{config['site_name']}.key")

# Login

Expand Down
1 change: 0 additions & 1 deletion firefly/base_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def id_channel(self):

@id_channel.setter
def id_channel(self, value):
logging.info("Set id_channel to", value)
self.main_window.id_channel = int(value)

@property
Expand Down
8 changes: 3 additions & 5 deletions firefly/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
logging.user = ""
logging.handlers = []



class FontLib():
def __init__(self):
self.data = {}
Expand Down Expand Up @@ -72,9 +70,9 @@ def get_pix(name):
color = 0xaaaaaa
icn.fill(QColor(color))
return icn
pixmap = QPixmap(":/images/{}.png".format(name))
pixmap = QPixmap(f":/images/{name}.png")
if not pixmap.width():
pix_file = os.path.join(app_dir, "images", "{}.png".format(name))
pix_file = os.path.join(app_dir, "images", f"{name}.png")
if os.path.exists(pix_file):
return QPixmap(pix_file)
return None
Expand Down Expand Up @@ -129,7 +127,7 @@ def notify_send(text, level=INFO):
ERROR : ["error", 10],
GOOD_NEWS : ["good news", 5]
}[level]
caption = "Firefly {}".format(caption)
caption = f"Firefly {caption}"
if level < WARNING:
return

Expand Down
2 changes: 1 addition & 1 deletion firefly/dialogs/batch_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class BatchOpsDialog(QDialog):
def __init__(self, parent, objects):
super(BatchOpsDialog, self).__init__(parent)
self.objects = sorted(objects, key=lambda obj: obj.id)
self.setWindowTitle("Batch modify: {} assets".format(len(self.objects)))
self.setWindowTitle(f"Batch modify: {len(self.objects)} assets")
id_folder = self.objects[0]["id_folder"]
self.keys = config["folders"][id_folder]["meta_set"]
self.form = MetaEditor(self, self.keys)
Expand Down
2 changes: 1 addition & 1 deletion firefly/dialogs/rundown.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SubclipSelectDialog(QDialog):
def __init__(self, parent, asset):
super(SubclipSelectDialog, self).__init__(parent)
self.setModal(True)
self.setWindowTitle("Select {} subclip to use".format(asset))
self.setWindowTitle(f"Select {asset} subclip to use")
self.ok = False
self.asset = asset
self.subclips = asset.meta.get("subclips", [])
Expand Down
4 changes: 2 additions & 2 deletions firefly/dialogs/send_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def __init__(self, parent, objects=[]):
if len(self.objects) == 1:
what = self.objects[0]["title"]
else:
what = "{} objects".format(len(self.objects))
what = f"{len(self.objects)} objects"

self.setWindowTitle("Send {} to...".format(what))
self.setWindowTitle(f"Send {what} to...")

self.actions = []
response = api.actions(objects=self.assets)
Expand Down
4 changes: 2 additions & 2 deletions firefly/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def load_filesystem(handler=False):
for letter in get_available_drives():
if handler:
handler(letter)
base_path = "{}:\\".format(letter)
base_path = f"{letter}:\\"
if not os.path.exists(base_path):
continue

Expand All @@ -40,4 +40,4 @@ def load_filesystem(handler=False):
if id_storage in config["storages"]:
config["storages"][id_storage]["protocol"] = "local"
config["storages"][id_storage]["path"] = base_path
logging.debug("Mapped storage {} to {}".format(id_storage, base_path))
logging.debug(f"Mapped storage {id_storage} to {base_path}")
2 changes: 1 addition & 1 deletion firefly/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def on_message(self, *args):
message = SeismicMessage(json.loads(data))
except Exception:
log_traceback(handlers=False)
logging.debug("[LISTENER] Malformed message: {}".format(data), handlers=False)
logging.debug(f"[LISTENER] Malformed message: {data}", handlers=False)
return

if message.site_name != self.site_name:
Expand Down
23 changes: 7 additions & 16 deletions firefly/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FireflyMainWidget(QWidget):
def __init__(self, main_window):
super(FireflyMainWidget, self).__init__(main_window)
self.main_window = main_window
current_tab = self.main_window.app_state.get("current_module",0)
current_tab = self.main_window.app_state.get("current_module", 0)
self.perform_on_switch_tab = True

self.tabs = QTabWidget(self)
Expand Down Expand Up @@ -68,14 +68,12 @@ def __init__(self, main_window):

self.tabs.currentChanged.connect(self.on_switch_tab)


def on_close(self):
self.detail.check_changed()
self.main_window.listener.halt()
QApplication.quit()
logging.debug("[MAIN WINDOW] Window closed")


@property
def app(self):
return self.main_window.app
Expand Down Expand Up @@ -119,9 +117,7 @@ def __init__(self, parent, MainWidgetClass):

super(FireflyMainWindow, self).__init__(parent, MainWidgetClass)
self.setWindowIcon(QIcon(get_pix("icon")))
title = "Firefly {}".format(FIREFLY_VERSION)
if FIREFLY_STATUS:
title += " " + FIREFLY_STATUS
title = f"Firefly {FIREFLY_VERSION}"
title += f" ({user['login']}@{config['site_name']})"
self.setWindowTitle(title)
self.setAttribute(Qt.WA_AlwaysShowToolTips)
Expand All @@ -143,12 +139,8 @@ def __init__(self, parent, MainWidgetClass):
self.set_channel(self.id_channel)
break


logging.info("[MAIN WINDOW] Firefly is ready")




def load_window_state(self):
self.window_state = self.app_state.get("window_state", {})
self.showMaximized()
Expand Down Expand Up @@ -250,11 +242,11 @@ def set_channel(self, id_channel):
for action in self.menu_scheduler.actions():
if hasattr(action, "id_channel") and action.id_channel == id_channel:
action.setChecked(True)
self.id_channel = id_channel
if self.scheduler:
self.scheduler.set_channel(id_channel)
self.scheduler.on_channel_changed()
if self.rundown:
self.rundown.set_channel(id_channel)
self.id_channel = id_channel
self.rundown.on_channel_changed()

def show_detail(self):
if self.main_widget.tabs.currentIndex() == 0:
Expand Down Expand Up @@ -315,7 +307,7 @@ def add_subscriber(self, module, methods):
def seismic_handler(self, message):
if message.method == "objects_changed" and message.data["object_type"] == "asset":
objects = message.data["objects"]
logging.debug("[MAIN WINDOW] {} asset(s) have been changed".format(len(objects)))
logging.debug(f"[MAIN WINDOW] {len(objects)} asset(s) have been changed")
asset_cache.request([[aid, message.timestamp + 1] for aid in objects])
return

Expand All @@ -327,9 +319,8 @@ def seismic_handler(self, message):
if message.method in methods:
module.seismic_handler(message)


def on_assets_update(self, *assets):
logging.debug("[MAIN WINDOW] Updating {} assets in views".format(len(assets)))
logging.debug(f"[MAIN WINDOW] Updating {len(assets)} assets in views")

self.browser.refresh_assets(*assets)
self.detail.refresh_assets(*assets)
Expand Down
22 changes: 9 additions & 13 deletions firefly/modules/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,12 @@ def selectionChanged(self, selected, deselected):
tot_dur += obj.duration

days = math.floor(tot_dur / (24*3600))
durstr = "{} days {}".format(days, s2time(tot_dur)) if days else s2time(tot_dur)
durstr = f"{days} days {s2time(tot_dur)}" if days else s2time(tot_dur)

if self.selected_objects:
self.main_window.focus(asset_cache[self.selected_objects[-1].id])
if len(self.selected_objects) > 1 and tot_dur:
logging.debug(
"[BROWSER] {} objects selected. Total duration {}".format(
len(self.selected_objects), durstr
)
)
logging.debug(f"[BROWSER] {len(self.selected_objects)} objects selected. Total duration {durstr}")
super(FireflyView, self).selectionChanged(selected, deselected)

@property
Expand All @@ -79,7 +75,7 @@ def on_header_clicked(self, index):
trend = "asc"
else:
trend = "asc"
self.parent().search_query["order"] = "{} {}".format(value, trend)
self.parent().search_query["order"] = f"{value} {trend}"
self.parent().load()


Expand All @@ -89,7 +85,7 @@ def on_activate(self, mi):
val = obj.show(key)

QApplication.clipboard().setText(str(val))
logging.info("Copied \"{}\" to clipboard".format(val))
logging.info(f"Copied \"{val}\" to clipboard")

def set_page(self, current_page, page_count):
self.current_page = current_page
Expand All @@ -109,7 +105,7 @@ def set_page(self, current_page, page_count):
else:
self.parent().pager.btn_next.setEnabled(True)

self.parent().pager.info.setText("Page {}".format(current_page))
self.parent().pager.info.setText(f"Page {current_page}")


class PagerButton(QPushButton):
Expand Down Expand Up @@ -236,7 +232,7 @@ def load_view_menu(self):
action = QAction(view["title"], self)
action.setCheckable(True)
if i < 10:
action.setShortcut("ALT+{}".format(i))
action.setShortcut(f"ALT+{i}")
action.id_view = id_view
action.triggered.connect(functools.partial(self.set_view, id_view))
self.action_search.addAction(action)
Expand Down Expand Up @@ -376,7 +372,7 @@ def link_exec(self, obj, **kwargs):
self._parent.new_tab(
obj["title"],
id_view=kwargs["id_view"],
conds=["'{}' = '{}'".format(param, value)]
conds=[f"'{param}' = '{value}'"]
)
self._parent.redraw_tabs()

Expand Down Expand Up @@ -410,7 +406,7 @@ def on_trash(self):
return
ret = QMessageBox.question(self,
"Trash",
"Do you really want to trash {} selected asset(s)?".format(len(objects)),
f"Do you really want to trash {len(objects)} selected asset(s)?",
QMessageBox.Yes | QMessageBox.No
)
if ret == QMessageBox.Yes:
Expand Down Expand Up @@ -444,7 +440,7 @@ def on_archive(self):
return
ret = QMessageBox.question(self,
"Archive",
"Do you really want to move {} selected asset(s) to archive?".format(len(objects)),
f"Do you really want to move {len(objects)} selected asset(s) to archive?",
QMessageBox.Yes | QMessageBox.No
)
if ret == QMessageBox.Yes:
Expand Down
Loading

0 comments on commit 82e930c

Please sign in to comment.