View Issue Details

IDProjectCategoryView StatusLast Update
0009955ScribusScripterpublic2016-11-25 02:19
Reporterale Assigned Toale  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version1.4.0svn 
Summary0009955: [patch] Scripter: after changeColor() the color list in the document is not updated
Description(and export to image is wrong)

patch attached.
Tags#pending, patch
PatchYes

Activities

ale

2011-04-22 07:18

manager   ~0026129

i've tried to update the list of colors in the style manager, too... but with no success...

ScCore->primaryMainWindow()->styleMgr()->updateColorList();

is failing with error:

In function ‘PyObject* scribus_setcolor(PyObject*, PyObject*)’:
/home/ale/docs/src/scribus14/scribus/plugins/scriptplugin/cmdcolor.cpp:105:49: error: request for member ‘exec’ in ‘ScCore->ScribusCore::primaryMainWindow()->ScribusMainWindow::styleMgr()’, which is of non-class type ‘StyleManager*’

ale

2011-04-22 07:22

manager  

patch (535 bytes)   
Index: plugins/scriptplugin/cmdcolor.cpp
===================================================================
--- plugins/scriptplugin/cmdcolor.cpp	(revision 16593)
+++ plugins/scriptplugin/cmdcolor.cpp	(working copy)
@@ -96,6 +96,9 @@
 			return NULL;
 		}
 		ScCore->primaryMainWindow()->doc->PageColors[col].setColor(c, m, y, k);
+		ScCore->primaryMainWindow()->doc->recalculateColors();
+		ScCore->primaryMainWindow()->doc->recalcPicturesRes();
+        // ScCore->primaryMainWindow()->styleMgr()->updateColorList();
 	}
 	else
 	{
patch (535 bytes)   

cbradney

2011-04-23 18:34

administrator   ~0026142

ScCore->primaryMainWindow()->styleMgr() would work a lot better

Kunda

2016-05-16 21:58

updater   ~0041143

ale, please advise ?

Kunda

2016-11-24 21:31

updater   ~0042528

@gpittman can you give this any love?

gpittman

2016-11-25 01:41

developer   ~0042535

Last edited: 2016-11-25 01:44

What I see as I look into this is that, first of all, changeColor() is deprecated. You should use either changeColorRGB() or changeColor CMYK().
Now, trying out changeColorRGB(), what I see is that the color is changed in the color list, but the objects using the color stay with the old hue. (also tried with changeColorCMYK(), and same thing happens.)
A workaround is to select the items, change their color to something else, then back to the original color name. Admittedly still a bug, but a particular kind of bug.
Something else that works that may be more useful is that if you click the 'Toggle Color Management System' on the toolbar, this also will result in the color switch. This may be more useful, suggesting a place to send a signal to.
Here is another workaround that is of interest. Say you changeColorRGB() for 'Green'. If you follow the command with replaceColor('Green','Green'), this acts like the 'Toggle Color Management System', so may be another place to look for a particular signal.

gpittman

2016-11-25 02:11

developer   ~0042536

Somewhere in actionmanager.cpp are these lines:

actionmanager.cpp: disconnect( (*scrActions)["viewToggleCMS"], 0, 0, 0);
actionmanager.cpp: connect( (*scrActions)["viewToggleCMS"], SIGNAL(toggled(bool)), currView, SLOT(toggleCMS(bool)));

actionmanager.cpp: (*scrActions)["viewToggleCMS"]->setTexts( tr("Toggle Color Management System"));

actionmanager.cpp: (*scrActions)["viewToggleCMS"]->setStatusTextAndShortcut( tr("Toggle color management system"));

gpittman

2016-11-25 02:19

developer   ~0042537

and further, regarding replaceColor():

actionmanager.cpp: name="editReplaceColors";
actionmanager.cpp: connect( (*scrActions)["editReplaceColors"], SIGNAL(triggered()), mainWindow, SLOT(slotReplaceColors()) );
actionmanager.cpp: (*scrActions)["editReplaceColors"]->setTexts( tr("Replace Colors..."));
actionmanager.cpp: << "editReplaceColors"
appmodehelper.cpp: (*a_scrActions)["editReplaceColors"]->setEnabled(true);
appmodehelper.cpp: (*a_scrActions)["editReplaceColors"]->setEnabled(false);
appmodehelper.cpp: (*a_scrActions)["editReplaceColors"]->setEnabled(false);
scribus.cpp: scrMenuMgr->addMenuItemString("editReplaceColors", "Edit");
scribus.cpp:void ScribusMainWindow::slotReplaceColors()
scribus.h: void slotReplaceColors();

Issue History

Date Modified Username Field Change
2011-04-22 07:17 ale New Issue
2011-04-22 07:18 ale Note Added: 0026129
2011-04-22 07:22 ale File Added: patch
2011-04-23 18:34 cbradney Note Added: 0026142
2011-04-28 09:52 plinnell Tag Attached: patch
2014-07-13 19:43 Kunda Assigned To => ale
2014-07-13 19:43 Kunda Status new => assigned
2014-10-24 23:00 Kunda Patch => Yes
2016-05-16 21:58 Kunda Note Added: 0041143
2016-05-16 21:58 Kunda Tag Attached: #pending
2016-11-24 21:31 Kunda Note Added: 0042528
2016-11-25 01:41 gpittman Note Added: 0042535
2016-11-25 01:44 gpittman Note Edited: 0042535
2016-11-25 02:11 gpittman Note Added: 0042536
2016-11-25 02:19 gpittman Note Added: 0042537