Skip to content

Instantly share code, notes, and snippets.

@mottosso
Created July 9, 2019 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mottosso/afa5ad92b5bbfd08e538589ccec67ec9 to your computer and use it in GitHub Desktop.
Save mottosso/afa5ad92b5bbfd08e538589ccec67ec9 to your computer and use it in GitHub Desktop.
9th July 2019 - Project Selector

Today I finally had a look at the project selector. It's something I've been postponing over and over, as the current mechinism worked. It just wasn't very comfortable.

Furthermore, it had no intuitive means of making multiple selections; such as a project and shot. There was a feature request looming over the mechanism as well, to be able to select a project by typing the first few characters.

Timetable

Time Task
07:00 Rename Allspark to Allzpark (see #28)
10:30 Project selector start, QComboBox with QCompleter
12:00 Struggling with integrated QLineEdit and QListView, trying QLineEdit
13:00 Lunch
15:00 QLineEdit works well, a little fiddly. If only I could get rid of that outline.
15:30 Wrap up and release new version at the office
16:00 End of day

Rename

Changing name of a project is never any fun, but better sooner than later, as configuration files and environment variables start getting set as ALLSPARK_CONFIG_FILE and such. There wasn't much to this, "allspark" was a rather unique string that was easily searched-and-replaced. The only crux was redirecting the allspark.sh domain to allzpark.com.


Project Selector

Projects are rather boring looking right now, and wouldn't scale to also selecting packages for assets or shots. Not having them in a solid enough state means making screenshots for documentation, not to mention actually documenting how it works, a little tricky. So I needed to get this out of the way.

image

image

Here's what I was going for:

projectselect

And here's what I ended up with.

Click on project icon, plus type

allzpark_projectselect1

Type and navigate

Double-TAB to re-select project, and continue editing. Arrow keys to switch from list, standard hotkeys like CTRL+A to select all and HOME to move to start of line works as expected.

allzpark_projectselect2

This took far too long, so I'm delaying the tree view and icons till next time.

In order to facilitate this behavior, as an added bonus projects are now fetched up-front, whereas before they were fetched on-demand. I initially thought fetching all versions of a project would be too costly, but have found that it's near instance. The benefit is that we're able to benefit from package metadata for a project in the GUI now, such as an icon (and label). For next time.


Allzpark Config

There's a new configuration file format I haven't mentioned yet, due to the impending name change. Since that's now done, here's how the configuration file works.

allzparkconfig.py

projects = [
    "alita",
    "spiderman",
    "hulk",
    "inception",
]

applications = [
    "maya",
    "nuke",
    "photoshop"
]

Save this file in your home directory, and Allzpark will use these for projects and apps. For greater flexibility, you can also provide a callable.

def projects():
    return os.listdir(r"c:\path\to\projects")

def applications():
    return os.listdir(r"c:\path\to\applications")

The output needs to be a list of strings, like above. We can use this mechanism to either list Rez packages from their parent folder, e.g. c:\packages\projects\alita\1.0\package.py. Or, it could be used to fetch projects from a database, like Shotgun or Ftrack. The function is called asynchrously, and displays a friendly message to the user in the GUI while waiting for a reply. Which means you can take your time to make relevant queries, such as which projects are active, which projects are associated to a given user along with the order in which projects should appear in the list. Perhaps the most frequently used should appear first? Up to you!

I'll continue exposing overrides via this configuration file, which can also be used from the command-line.

allzpark --config-file allzparkconfig.py

At the moment, there can only ever be 1 config. The values in this file override the values from the default config file, but if you wanted to, for example, have one global config along with configs per department, user or even project then that isn't possible right now. It's simple enough, and the interface is built for a cascading setup like this, I just didn't do it to KISS until it was actually needed.


Tomorrow

Here's what I'll have a look at tomorrow.

  • The version selector still isn't functioning. It's updating, you can click it, but it won't do anything.
  • Project graphic still isn't coming from the actual package. A package should provide its own (optional) icon which is displayed there.
  • There should be a "banner" per project, for extra flair. (see [#15#(mottosso/allzpark#15))

That should wrap up all placeholder functionality GUI, from there we can start having a look at what functionality is missing, aside from the obvious styling concerns.

For a complete list of things remaining, see the issues section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment