Jump to content

Mattias Lagergren

Administrators
  • Posts

    1,083
  • Joined

  • Last visited

  • Days Won

    90

Everything posted by Mattias Lagergren

  1. Hi Remus, You are correct, the session is not thread safe. Just to confirm; if you create a session per thread - does it work as expected then?
  2. Hi Chris, welcome to the forums. Would this be a time logging entry or perhaps better tracked as a custom attribute on the entity? Time logging is primarily meant to track how much time a user has been actively working on a task.
  3. Yes, it is using the ftrack event hub service to do this. So it will work in different sites / locations.
  4. Unfortunately there is no reliable way of detecting the machine from the browser, not in a way that can be re-created from python. I've made a small plugin (see code below) that detects if there are multiple instances of Connect running for a user and pops up a message. If this functionality makes sense and you like it, we may bundle the plugin in Connect. import logging import socket import functools from QtExt import QtWidgets, QtCore import ftrack_api import ftrack_connect.util import ftrack_connect.ui.application logger = logging.getLogger( 'multiple-instances-plugin' ) def open_warning_dialog(message): '''Open warning window.''' parent = None for item in QtCore.QCoreApplication.instance().topLevelWidgets(): if isinstance(item, ftrack_connect.ui.application.Application): parent = item dialog = QtWidgets.QMessageBox(parent=parent) dialog.setText(message) dialog.setIcon(QtWidgets.QMessageBox.Critical) dialog.exec_() def handle_reply(event): '''Handle reply event if someone else is already running Connect.''' logger.warning('Someone else is already running connect: {0}'.format(event)) ftrack_connect.util.invoke_in_main_thread( open_warning_dialog, u'ftrack Connect is already running on machine: {0}'.format( event['data']['machine'] ) ) def callback(event): '''Handle start of another connect.''' logger.warning('Someone just started ftrack Connect: {0}'.format(event)) ftrack_connect.util.invoke_in_main_thread( functools.partial( open_warning_dialog, u'Connect just opened on machine: {0}'.format( event['data']['machine'] ) ) ) return {'machine': socket.gethostname()} def register(session, **kw): '''Register hooks.''' logger.info( 'Register detection of multiple Connect instances' ) # Validate that session is an instance of ftrack_api.session.Session. If # not, assume that register is being called from an old or incompatible API # and return without doing anything. if not isinstance(session, ftrack_api.Session): logger.debug( 'Not subscribing plugin as passed argument {0!r} is not an ' 'Session instance.'.format(session) ) return session.event_hub.subscribe( 'topic=studio.ftrack-connect.start and source.id != "{0}" and ' 'data.username = "{1}"'.format( session.event_hub.id, session._api_user ), callback ) session.event_hub.publish( ftrack_api.event.base.Event( topic='studio.ftrack-connect.start', data={ 'username': session._api_user, 'machine': socket.gethostname() } ), on_reply=handle_reply ) To use it create a folder detect-multi-instance/hook/ inside the ftrack connectp plugins folder, and add the code in a plugin.py (don't forget the hook/ folder). Restart Connect for the plugin to source. This simple example could be extended with the ability to "quit" other instances of ftrack Connect.
  5. No good reason, I'm afraid that we haven't implemented support for it yet.
  6. It is not possible to restrict it at the moment. Do you run them on the same machine or multiple machines but the same user is logged in? Edit: it would probably be possible to do this as a plugin to Connect.
  7. Could you try to adda a small "time.sleep(..)" after initialising the new session? It could be that the event hub is not yet connected when the event is emitted.
  8. At the bottom of this article there is some information about triggering an action interface: http://help.ftrack.com/developing-with-ftrack/key-concepts/actions I hope this helps!
  9. For a local deployment it is possible to override the create project dialog with your own - and make the validations that way. You can find more information here: http://ftrack.rtd.ftrack.com/en/stable/administering/managing_local_installation/configuring_server_options.html#override-the-default-create-project-behavior Other alternatives are to setup an event listener and validate the project name. If not valide you can change it or ask the user to change it via a triggered action interface.
  10. Hi Remus, this could be done in two other ways at the moment: Trigger an action dialog for the user with the information. You can just use label with markdown to get the message through. Create a job to show the user progress. As for the notification system we have ideas of revamping the notifications and at the same time give the ability to add your own. Note that this is just internal discussions at the moment.
  11. At the moment it is not possible, but you can of course save this in a "text" attribute and not use the number attribute. Number attributes can either be "decimal" - 2 decimals, or not (in which case you can have frame 1001)
  12. I suspect that this happens because the event is neither attached to user or a project. If you modify the example to attach it to a project, does it show up then? import moment import ftrack_api session = ftrack_api.Session() project = session.query('Project').first() session.create( 'CalendarEvent', { 'name': 'Foo', 'start': arrow.get('2017-01-03'), 'end': arrow.get('2017-02-03'), 'project_id': project['id'] } ) session.commit()
  13. It is possible, but the new api works a bit differently. You can read some usage examples here: http://ftrack-python-api.rtd.ftrack.com/en/stable/example/index.html A calendar event could be created and committed like this: import moment import ftrack_api session = ftrack_api.Session() session.create( 'CalendarEvent', { 'name': 'Foo', 'start': arrow.get('2017-01-03'), 'end': arrow.get('2017-02-03') } ) session.commit()
  14. Hi Remus, thank you for the request - we are already considering this (follow/unfollow) as part of a future change to the notifications feature. I will make sure to incorporate this information any future research
  15. It is primarily meant for modifying the environment where you launch the application. Here is an example: http://ftrack-connect.rtd.ftrack.com/en/stable/developing/tutorial/adding_a_location.html#developing-tutorial-adding-a-location-modifying-application-launch
  16. Hi Toke, as of now the component is determined based on the configuration of your Asset types (from System settings). Long term this is something that we want to move away from and allow a more flexible way of selecting which components are played.
  17. Works for me when testing now
  18. Thanks for elaborating - I will add your posts for consideration if/when we move forward with the time logging improvements.
  19. Nice! So the image - does that show your current time-logger that integrates with ftrack? And if I understand you correct you would like the same features in the ftrack web UI?
  20. It is not something that we've planned for the near future. But I've just created this as an idea on the roadmap: https://trello.com/b/KzHjF9vb/ftrack-roadmap
  21. Here is an action listing the names and links for each invitee: import logging import ftrack_api logging.basicConfig(level=logging.INFO) session = ftrack_api.Session() identifier = 'review-session-list-invitees' def discover(event): '''Return action for event.''' for selected_item in event['data'].get('selection', []): if selected_item['entityType'] == 'reviewsession': return { 'items': [{ 'label': 'List invitees', 'actionIdentifier': identifier }] } session.event_hub.subscribe( 'topic=ftrack.action.discover', discover ) def launch(event): '''Launch *event*.''' items = [] for selected_item in event['data'].get('selection', []): if selected_item['entityType'] == 'reviewsession': review_session = session.get( 'ReviewSession', selected_item['entityId'] ) items.append({ 'type': 'label', 'value': u'**Invitees for {0}**'.format(review_session['name']) }) for invitee in review_session['review_session_invitees']: items.append({ 'type': 'label', 'value': u'{0}: {1}/review/{2}'.format( invitee['name'], # Do not use private variable. session._server_url, invitee['id'] ) }) return { 'items': items } session.event_hub.subscribe( 'topic=ftrack.action.launch and ' 'data.actionIdentifier="{0}"'.format(identifier), launch ) session.event_hub.wait()
  22. This is not supported out-of-the-box but could be added using the Actions framework. So with some simple python you could add an interface that displays the links for each reviewer to allow copy/paste.
  23. Cool, I will add your name as a reference to the feature request ticket we have
  24. No, I'm afraid development of this feature got pushed and at the moment I do not have any dates for it. Is it the same use-case, to have a day rate attribute? You can use it from the Users & Groups page in system settings and see it on the sidebar for a user. It is also possible to retrieve it from the API.
×
×
  • Create New...