View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002047 | Scribus | Scripter | public | 2005-06-02 13:05 | 2005-06-24 18:42 |
Reporter | fcoiffie | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Platform | i386 | OS | Linux | OS Version | Gentoo |
Product Version | 1.3.0cvs | ||||
Fixed in Version | 1.3.0cvs | ||||
Summary | 0002047: Function to convert unit in another unit (mm -> pt) | ||||
Description | I'm looking for a way to convert a size in mm to a size in pt in a Python script. I can't find any function like that. I think it should be useful to add a function which can convert units (mm, picas...) in pt. | ||||
Tags | No tags attached. | ||||
Patch | |||||
|
That seems reasonable. I'd actually prefer to expose some constants that you can multiply/divide by to go to/from points, eg: mm -> in : (value/mm)*in since that helps reduce the growing bloat of functions in the API, is WAY faster (Python function calls are very slow) and those constants will be useful for other things later. |
|
In fact, yesterday, I did the same thing with my Python code : I looked inside the scribus source code to find these constants. So, these constants could be available as Python constants. I thing it's very easy to do and very useful. |
|
units.cpp contains the functions for this. |
|
cbradney, while we can use util.cpp for the scripter, I'm not sure it's better than just exporting some constants. Function calls in Python are (alas) really slow, and I'd like to avoid adding yet more API functions if I can avoid it. I figure the best way to do things is probably to use the util.cpp functions to initialize the constants we export to the user. That makes sure things are still all done in one place, but avoids the overhead of the function calls and yet more wrappers in the scripter. Sound sensible? |
|
However it works best, as long as Scripter relies on units.cpp on startup to get the correct vales for conversion. You can reproduce similar functions in Scripter directly, but as you say initialise variables for those functions with those from units.cpp. |
|
Current 1.3cvs exports conversion constants `pt', `inch', `mm', `cm', etc into the `scribus' module so you can quickly and easily convert units, eg: setPosition(10*cm, 10*cm) |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-06-02 13:05 | fcoiffie | New Issue | |
2005-06-02 14:27 |
|
Note Added: 0004877 | |
2005-06-02 14:27 |
|
Status | new => acknowledged |
2005-06-02 14:27 |
|
Status | acknowledged => assigned |
2005-06-02 14:27 |
|
Assigned To | => ringerc |
2005-06-03 05:12 | fcoiffie | Note Added: 0004878 | |
2005-06-03 21:19 | cbradney | Note Added: 0004886 | |
2005-06-05 19:50 | cbradney | Relationship added | related to 0001689 |
2005-06-05 19:53 | cbradney | Relationship added | related to 0002053 |
2005-06-06 12:05 |
|
Note Added: 0004915 | |
2005-06-06 12:12 | cbradney | Note Added: 0004916 | |
2005-06-12 05:46 |
|
Status | assigned => resolved |
2005-06-12 05:46 |
|
Fixed in Version | => 1.3.0cvs |
2005-06-12 05:46 |
|
Resolution | open => fixed |
2005-06-12 05:46 |
|
Note Added: 0004997 | |
2005-06-24 18:42 | cbradney | Status | resolved => closed |
2006-05-13 21:35 | christoph_s | Relationship added | child of 0003813 |