| August 25, 2010 7:24 pm

ScribusFor most things, I really like Scribus.  It’s a marvelous program that is easy to use and extremely powerful.  With that said, there is one design decision that drives me absolutely nuts:  the use of top-level windows for tool palettes.

I could go on (at length) about why this bothers me.  (If I were to do so, I might talk about how the palette windows block the view of my work, or the way in which they clutter up the desktop and make it difficult to have more than one program open at a time.)

But, since a picture is worth a thousand words, I’m not going to do that.  I’ll simply show you what working on a complicated document in Scribus can turn into.

Scribus - Top Level Windows - Complex

As you can see, it isn’t pretty.  There’s superfluous windows everywhere!  And because the display palettes require the vast majority of the desktop, the important stuff (your content) is relegated to a tiny parcel of the screen.

Now, my point in this post isn’t to beat up on the Scribus developers.  They’re well aware that top-level window palettes are not the best way to show a lot of information on-screen.  After talking with one of them yesterday, I was told that there are plans to re-work the UI and fix a number of the more obvious issues.  These enhancements will be in version 1.5 of the software.  (All I can say is: Go Team!)

Unfortunately, future plans do not fix current annoyances.  Nor am I content to wait for a fix.  I’m just not that patient.  Thus, I’ve been researching different ways to solve the Palette Problem, and, it turns out that there is a very elegant solution already used in other graphics programs.  This is to use dockable/floating widgets.

The Solution

In many respects, dock widgets work just like the top-level windows that Scribus uses now.  They can hold complex layouts, options and tool palettes.  You can arrange them on the desktop as you see fit.  There is, however, one important distinction.  Instead of requiring their own space, you can also “dock” them to the main window.

When docked, they will appropriately re-size, and you can even “stack” them on top of one another.  Using dock-widgets, you can transform the mess above into the much more pleasing layout below.

Scribus - Dock Widgets 2[7]

All the same tools and options are available, they’re just organized and accessible.  It’s a much better system.  Moreover, if you don’t need a particular palette (such as the Scrapbook or Outline), it can easily be hidden but still remain accessible.

Scribus - Dock Widgets 1

Now, you might be tempted to think that making such a magical transformation is difficult.  It is, after all, a major change.  But were to you subscribe to such a supposition, you would be wrong.  Transforming the Scribus GUI isn’t difficult in the least.  It simply requires that you download and run a couple of Python scripts.  In the remainder of this post, I’ll describe how to leave Palette Hell behind.

Downloads and Installation

All of the magic happens through the Scripter plug-in, and four custom scripts (one written by a guru, three hacked together by me).  Scripter is included in the scribus-ng package available from most distribution repositories.  I have tested these with Scribus 1.3.5 and Scribus 1.3.8 on Ubuntu and can testify that they work great.

After you download the archive, extract it to a folder somewhere on your computer.  Be sure to keep all four scripts inside the same folder, otherwise they will not work. Next, change your Scribus “Scripts” path to point at this folder.

The paths options are available under the “General Preferences” (File > Preferences > General).

Scribus - Preferences - Paths

Configuration

Once you have copied the scripts to the appropriate location, there is one setting that you need to change prior to using them.  The scripts create a simple text file called “WindowSetttings.conf” that stores the location of the dock widgets.  You will need to specify a path where you would like this to file to be stored.  For example, I store the file in my AppData folder:

/home/roakes/AppData/Applications/Scrbus

You will need to change the path in both “SaveWorkspace.py” and “LoadWorkspace.py”.   Make sure that the two match!

Usage

After you have installed and configured the python files, you are ready to use them.  As I said earlier, there are four scripts in total to handle all of your dock widget needs:

  • DockWidgets.py, which converts the top level window objects to dock widgets.  By default, it places these widgets on the right hand of the Window.
  • SaveWorkspace.py, which can be used to save your widget configuration.
  • LoadWorkspace.py, used to load your previously saved workspace.
  • Scribus_Startup.py, which can be used to load a previously saved workspace when Scribus first opens.

Scribus - Run Script - ExtensionAll of the scripts are run from the “Scripts > Execute Script” menu.  Note: When using them, it is important to run the code as an “Extension Script.”  If you don’t, they will cause Scribus to freeze.

This is the order that the scripts should be run:

  1. First, run DockWidgets.py.  The first time you run this script, it will load all of the dock widgets into the right hand pane.  You can then reorder the widgets to your liking.
  2. Next, run SaveWorkspace.py.  This will save the layout so that you can retrieve it later.
  3. You can then load your saved layout again by using LoadWorkspace.py.

Unfortunately, the changes made by DockWidgets.py are not permanent.  If you exit Scribus, you will be back in Palette Hell.  This is why the fourth script (Scribus_Startup.py) was included.

Scribus (theoretically) includes the ability to run a user-defined script on a start-up.  (I wasn’t actually able to get this to work, but others apparently have.)  Scribus_Startup.py runs DockWidgets.py and LoadWorkspace.py for you.  If you set it as your startup script, you will never have to worry about Palette Hell ever again.


To set it as a startup script, open the Scripter preferences (File > Preferences > Scripter) and type in the path to the script (or select it from the file browser).  Just make sure that Scribus_Startup.py is in the same directory as DockWidgets.py and LoadWorkspace.py.

Comments

7 Responses to “Scribus, Dockable Windows and Workspaces”

Brian wrote a comment on April 16, 2011

Hello. I am currently using a Windows XP machine (32 bit). I am new to Scribus, and have enjoyed using it over the other expensive program for desktop publishing. In Scribus I have a prewritten script I would like to run. The beginning of the script contains:

!/usr/bin/env python

– coding: utf-8 –

from PyQt4.QtCore import * from PyQt4.QtGui import *

class DockDialog(QDockWidget):

I have installed Python 3.2 via ActivePython (after trying to install from python.org). After the install I then opened a DOS window and typed pymp install pyqt4, which, as far as I could tell installed properly. I then tried to run the script in Scribus and received the following message:

Traceback (most recent call last): File “”, line 8, in ? File “C:/Program Files/Scribus 1.3.3.14/share/scripts/Scribus-DockWidgets/DockWidgets.py”, line 4, in ? from PyQt4.QtCore import * ImportError: No module named PyQt4.QtCore

I then tried reinstalling PYQT4, by typing what I had before, and I was told that PYQT4 was already installed via:

skipping “pyqt4″ already installed at “%APPDATA%\Python” (3.2)

After looking in c:\Python32 in all of the directories I can not find any PYQT files. Where were they installed? How do I make sure that script is able to fing the PYQT4 files necessary to run?

My PATH variable is:

C:\Python32\;C:\Python32\Scripts;

Ultimately I would like help in getting the scribus script to work.

Thank you for your help!

Rob Oakes wrote a comment on April 23, 2011

HI Brian,

I’m sorry to hear that you having troubles. Below are a few thoughts on what might be causing them and how you could fix the problem. My apologies, this was written late, so there isn’t much of a logic or order to these ramblings.

The first thing that pops to mind is that there might be a problem with your PyQt install. For that reason, I would try is to see if you can load PyQt. Go to the command line and type:

python

Then, once the interpreter is running, type:

from PyQt4 import QtGui

If you have PyQt installed correctly, it should load the QtGui module of PyQt. If there is a problem with your Qt installation, then you will get an error similar to the one that you describe above.

With that said, even if you have PyQt installed and working correctly, that may not solve your problem. On Windows, Python doesn’t ship installed. I think that the Scribus people ship their own embedded interpreter so that Scribus will work correctly. If that’s the case, then you may try pointing Scribus at your system Python. That may let you use the script. (This can be done from the Settings dialog.)

I am sorry that I can’t give you a more detailed set of instructions to work around the issue. While I use Windows, it’s not a platform I spend a lot of time laying with. (I mostly just use it for web, email, and music.) For that reason, I haven’t tested this script on it. Nor, for that matter, have I really tested it on Mac OS X (again, a platform I use for web, email and music). The only platform I know it works on is Linux. Best of luck though. please let me know how things go with your experiments.

Cheers,

Rob

Brisjer wrote a comment on July 19, 2011

Great post, just what I was after

Brisjer wrote a comment on July 19, 2011

One question, is it posible to get the properties box docked also?
Seing as its so critical to editing in Scribus, an option should be to dock it.

One tiny detial I noticed is that when dragging the docks & windows around, the grab handles behave strangely, quite accurate clicking is needed.

Great work, couldn’t get the save/startup to work either..

Rob Oakes wrote a comment on July 19, 2011

Hi Brisjer,

I’m not really sure. This as a hack that I threw together quickly. Have you tried adding “properties” to the beginning of the script? (This is only a recommendation, I haven’t test it yet.) That may get you the effect that you’re looking for.

Also, regarding the “accurate clicking,” you may find that if you compile build Scribus against different versions of Qt, it may behave better. I’m not sure which platform you’re on (Linux, Windows, Mac) or which distribution you use if on Linux (Ubuntu, openSUSE, etc.). All of them include different versions of Qt, and that can have a significant effect on how the palette behaves.

If you find the improvement beneficial, you might consider writing a note to the developers list. They talked about trying to implement the Scribus tools as dock widegets. I’m not sure if it ever went anywhere. (Though I know they would be open to a patch, were I to put one together.) If another user recommended the change, it might hasten the switch.

Cheers,

Rob

Phil wrote a comment on October 30, 2011

Hi Rob,

thanks for sharing these useful scripts! They work great for me and saved me a lot of headaches with the windows madness. I hope that this might be possible wihout additional scripts in scribus 1.4 finally ;)

Cheers
Phil

Rob Oakes wrote a comment on October 31, 2011

Hi Phil,

Glad to hear that they were useful.

I also agree, I really hope that the final version of Scribus 1.4 makes use of dock widgets instead of free floating Windows. When I first put the scripts together, I sent them to the Scribus users list and got a response that they change it. That was a while ago, though, and I haven’t heard anything back as to whether they were going to follow through.

I suppose, at the end of the day, though, that I could submit a patch to do the same thing. It just means swapping out one type of control for the other.

Sigh. So many well-meaning things to do, so little time to actually do them.

Cheers,

Rob

Care to comment?