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

 
 

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

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

Submitted by:  Bernhard Reiter <bernhard>
Submitted on:  Mon 31 Oct 2005 11:35:41 AM UTC  
Votes:  10  
 
Category: 0.7.xPriority: 4
Status: NonePrivacy: Public
Assigned to: Bernhard Herzog <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>
Project 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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project 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>
Project Administrator

 

Attached Files
file #6473:  poster-sv4582-3.py added by bernhard (15kB - application/x-python - Third revision.)
file #6689:  poster-sv4582-2.py added by bernhard (14kB - application/x-python - poster.py second try)
file #7424:  poster.py added by bernhard (12kB - 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

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 10 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 5 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 10 Nov 2005 08:46:18 AM UTCbernhardAttached File-=>Added poster-sv4582-3.py, #5454
  Carbon-Copy-=>Added bernhard
Wed 09 Nov 2005 12:09:22 AM UTCbernhardCarbon-Copy-=>Added bh
Wed 09 Nov 2005 12:09:21 AM UTCbernhardAttached File-=>Added poster-sv4582-2.py, #5448
Mon 31 Oct 2005 11:35:42 AM UTCbernhardAttached File-=>Added poster.py, #5410

Back to the top


Powered by Savane 3.1-cleanup