patchSkencil - Patches: patch #4582, Direct "poster" support...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #4582: Direct "poster" support by Markus Rechtien

Submitter:  Bernhard Reiter <bernhard>
Submitted:  Mon 31 Oct 2005 11:35:41 AM UTC
Votes: 10
 
Category:  0.7.x Priority:  4
Status:  None Privacy:  Public
Assigned to:  bh Open/Closed:  Open

Thu 10 Nov 2005 08:46:18 AM UTC, comment #4: 

attaching improved poster-sv4582-3.py:

        * Improved: Error checking for the output filename selection.
        * Added: Ask back if an existing file should really be overwritten.
        * Added a couple of TODO entries.
        * Completed poster.py TODO:
                20051031 replace deprecated gtk.Combo with gtkComboBox or BH's
                         Sketch.UI.gtkmisc.CommonComboBox or so.
          so there are no deprecation warning in poster.py anymore.

Bernhard Reiter <bernhard>
Group administrator
Wed 09 Nov 2005 12:09:21 AM UTC, comment #3: 

The new poster.py is improved.
Obviously I cannot fix 5., so this remains untouched.
4. was done easily.

As for 1.,2. and 3.:
I have decided to actually build a string
for a command that would use a pipe for printing.
The reason is that the argv usage of popen* is not really documented
and with the argv usage I cannot create a pipe directly.
Simple, but sufficient shell argument quoting is implemented now.

In addition I have improved the error checking.

Bernhard Reiter <bernhard>
Group administrator
Sat 05 Nov 2005 07:28:19 PM UTC, comment #2: 

I had a look at this.  Some relatively simple things that should be fixed:

1. It assembles shell commands as a string without doing proper quoting of e.g. filenames.  Best is to avoid assembling a command as a single string completely and to always use a list of argv components.  The popen functions in Python accept those too.  Best would be to use the subprocess module from Python 2.4 (that would require raising the minimum python version I think)

2. If not explicitly selecting a file to write to, the plugin writes to a file called "temp.ps" in the current directory.  This might overwrite existing files and it may not work sometimes since the current working directory might mot be writable.  The plugin should use proper temporary files or pipe the output of poster directly to lpr, or somesuch.

3. the logic of deleting temp.ps looks wrong:

        if outfile and outfile.name == "tmp.ps":
            os.remove(outfile.name)

This could delete a file the user wanted to create explicitly. Keep a separate flag of whether there's a file that needs to be removed.

4. at least one typo:  orrured instead of occurred.


5. This shouldn't be a PluginCompound plugin.  It doesn't define a new object type. The only reason this isn't a problem yet is that Skencil 0.7 doesn't have a menu for plugin types yet.
For poster.py to be loaded automatically, Skencil needs a new plugin type, though.

Bernhard Herzog <bh>
Group administrator
Mon 31 Oct 2005 11:52:04 AM UTC, comment #1: 

Obviously the "ΓΌ" in the TODO comment needs to go
before applying the patch.

Bernhard Reiter <bernhard>
Group administrator
Mon 31 Oct 2005 11:35:41 AM UTC, original submission:  

Skencil Tool dialog for printing large ps poster via the "poster" tool. Originally by Markus Rechtien.
Tested with Skencil CVS from 20051029.

This is usable, but also
see the TODO list at the top of the file.

I suggest placing the file in a freshly created directory
call "Tools" below "Plugins".
So you get Plugins/Tools/poster.py.

Bernhard R.

Bernhard Reiter <bernhard>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #6473:  poster-sv4582-3.py added by bernhard (15KiB - application/x-python - Third revision.)
file #6689:  poster-sv4582-2.py added by bernhard (14KiB - application/x-python - poster.py second try)
file #7424:  poster.py added by bernhard (12KiB - application/x-python - Skencil Tool dialog for printing large ps poster via the "poster" tool. )

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 10 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-11-10 bernhard Attached File- Added poster-sv4582-3.py, #5454
    Carbon-Copy- Added bernhard
2005-11-09 bernhard Carbon-Copy- Added bh
2005-11-09 bernhard Attached File- Added poster-sv4582-2.py, #5448
2005-10-31 bernhard Attached File- Added poster.py, #5410

Back to the top

Powered by Savane 3.14-f13d.
Corresponding source code