mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'develop' into enhancement/dynamic_default_modules
This commit is contained in:
commit
08b7657279
143 changed files with 3352 additions and 2391 deletions
|
|
@ -492,7 +492,8 @@ class DeleteOldVersions(BaseAction):
|
|||
os.remove(file_path)
|
||||
self.log.debug("Removed file: {}".format(file_path))
|
||||
|
||||
remainders.remove(file_path_base)
|
||||
if file_path_base in remainders:
|
||||
remainders.remove(file_path_base)
|
||||
continue
|
||||
|
||||
seq_path_base = os.path.split(seq_path)[1]
|
||||
|
|
|
|||
|
|
@ -26,3 +26,12 @@ class LogsWindow(QtWidgets.QWidget):
|
|||
self.log_detail = log_detail
|
||||
|
||||
self.setStyleSheet(style.load_stylesheet())
|
||||
|
||||
self._frist_show = True
|
||||
|
||||
def showEvent(self, event):
|
||||
super(LogsWindow, self).showEvent(event)
|
||||
|
||||
if self._frist_show:
|
||||
self._frist_show = False
|
||||
self.logs_widget.refresh()
|
||||
|
|
|
|||
|
|
@ -155,6 +155,11 @@ class LogsWidget(QtWidgets.QWidget):
|
|||
QtCore.Qt.DescendingOrder
|
||||
)
|
||||
|
||||
refresh_triggered_timer = QtCore.QTimer()
|
||||
refresh_triggered_timer.setSingleShot(True)
|
||||
refresh_triggered_timer.setInterval(200)
|
||||
|
||||
refresh_triggered_timer.timeout.connect(self._on_refresh_timeout)
|
||||
view.selectionModel().selectionChanged.connect(self._on_index_change)
|
||||
refresh_btn.clicked.connect(self._on_refresh_clicked)
|
||||
|
||||
|
|
@ -169,10 +174,12 @@ class LogsWidget(QtWidgets.QWidget):
|
|||
self.detail_widget = detail_widget
|
||||
self.refresh_btn = refresh_btn
|
||||
|
||||
# prepare
|
||||
self.refresh()
|
||||
self._refresh_triggered_timer = refresh_triggered_timer
|
||||
|
||||
def refresh(self):
|
||||
self._refresh_triggered_timer.start()
|
||||
|
||||
def _on_refresh_timeout(self):
|
||||
self.model.refresh()
|
||||
self.detail_widget.refresh()
|
||||
|
||||
|
|
|
|||
|
|
@ -35,20 +35,25 @@ class CollectSlackFamilies(pyblish.api.InstancePlugin):
|
|||
return
|
||||
|
||||
# make slack publishable
|
||||
if profile:
|
||||
self.log.info("Found profile: {}".format(profile))
|
||||
if instance.data.get('families'):
|
||||
instance.data['families'].append('slack')
|
||||
else:
|
||||
instance.data['families'] = ['slack']
|
||||
if not profile:
|
||||
return
|
||||
|
||||
instance.data["slack_channel_message_profiles"] = \
|
||||
profile["channel_messages"]
|
||||
self.log.info("Found profile: {}".format(profile))
|
||||
if instance.data.get('families'):
|
||||
instance.data['families'].append('slack')
|
||||
else:
|
||||
instance.data['families'] = ['slack']
|
||||
|
||||
slack_token = (instance.context.data["project_settings"]
|
||||
["slack"]
|
||||
["token"])
|
||||
instance.data["slack_token"] = slack_token
|
||||
selected_profiles = profile["channel_messages"]
|
||||
for prof in selected_profiles:
|
||||
prof["review_upload_limit"] = profile.get("review_upload_limit",
|
||||
50)
|
||||
instance.data["slack_channel_message_profiles"] = selected_profiles
|
||||
|
||||
slack_token = (instance.context.data["project_settings"]
|
||||
["slack"]
|
||||
["token"])
|
||||
instance.data["slack_token"] = slack_token
|
||||
|
||||
def main_family_from_instance(self, instance): # TODO yank from integrate
|
||||
"""Returns main family of entered instance."""
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class IntegrateSlackAPI(pyblish.api.InstancePlugin):
|
|||
message = self._get_filled_message(message_profile["message"],
|
||||
instance,
|
||||
review_path)
|
||||
self.log.info("message:: {}".format(message))
|
||||
self.log.debug("message:: {}".format(message))
|
||||
if not message:
|
||||
return
|
||||
|
||||
|
|
@ -43,7 +43,8 @@ class IntegrateSlackAPI(pyblish.api.InstancePlugin):
|
|||
publish_files.add(thumbnail_path)
|
||||
|
||||
if message_profile["upload_review"] and review_path:
|
||||
publish_files.add(review_path)
|
||||
message, publish_files = self._handle_review_upload(
|
||||
message, message_profile, publish_files, review_path)
|
||||
|
||||
project = instance.context.data["anatomyData"]["project"]["code"]
|
||||
for channel in message_profile["channels"]:
|
||||
|
|
@ -75,6 +76,19 @@ class IntegrateSlackAPI(pyblish.api.InstancePlugin):
|
|||
dbcon = mongo_client[database_name]["notification_messages"]
|
||||
dbcon.insert_one(msg)
|
||||
|
||||
def _handle_review_upload(self, message, message_profile, publish_files,
|
||||
review_path):
|
||||
"""Check if uploaded file is not too large"""
|
||||
review_file_size_MB = os.path.getsize(review_path) / 1024 / 1024
|
||||
file_limit = message_profile.get("review_upload_limit", 50)
|
||||
if review_file_size_MB > file_limit:
|
||||
message += "\nReview upload omitted because of file size."
|
||||
if review_path not in message:
|
||||
message += "\nFile located at: {}".format(review_path)
|
||||
else:
|
||||
publish_files.add(review_path)
|
||||
return message, publish_files
|
||||
|
||||
def _get_filled_message(self, message_templ, instance, review_path=None):
|
||||
"""Use message_templ and data from instance to get message content.
|
||||
|
||||
|
|
@ -210,6 +224,9 @@ class IntegrateSlackAPI(pyblish.api.InstancePlugin):
|
|||
# You will get a SlackApiError if "ok" is False
|
||||
error_str = self._enrich_error(str(e.response["error"]), channel)
|
||||
self.log.warning("Error happened {}".format(error_str))
|
||||
except Exception as e:
|
||||
error_str = self._enrich_error(str(e), channel)
|
||||
self.log.warning("Not SlackAPI error", exc_info=True)
|
||||
|
||||
return None, []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue