Discussion:
about sif.py and others in guiqwt
Carlos Noriega
2011-11-23 23:02:55 UTC
Permalink
Hi People:
Ihave two questions:
1) sift.py works with other files (tools.py, plot.py, etc.), where I work with
the context menu to add or remove options
2) the tool annotatedSegmentTool shows distance in pixels, but I'm looking
for where you store this result (numeric variable) to make a
conversion from pixels
in a real size of a photograph loaded


Thanks in advance


Carlos Noriega

LoB -Laboratory of Biophysics - USP

Av. Mello de Moraes, 65 CEP 05508-030 São Paulo/SP

University of São Paulo - Brazil

tlfn: 11-30918735 cel:11-69634011

E-mail: clnoriega-2SlJjJXS+***@public.gmane.org
Carlos Pascual
2011-11-24 07:43:31 UTC
Permalink
Post by Carlos Noriega
1) sift.py works with other files (tools.py, plot.py, etc.), where I work
with the context menu to add or remove options
I do not understand this question. What do you want to do?
Post by Carlos Noriega
2) the tool annotatedSegmentTool shows distance in pixels, but I'm looking
for where you store this result (numeric variable) to make a
conversion from pixels
in a real size of a photograph loaded
I haven't tried myself, but I guess what you need is
AnnotatedSegment.get_tr_length()
or get_text() or get_infos()
See:
http://packages.python.org/guiqwt/reference.html#guiqwt.annotations.AnnotatedSegment
Post by Carlos Noriega
Thanks in advance
Carlos Noriega
LoB -Laboratory of Biophysics - USP
Av. Mello de Moraes, 65 CEP 05508-030 São Paulo/SP
University of São Paulo - Brazil
tlfn: 11-30918735 cel:11-69634011
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
Carlos Noriega
2011-11-24 11:55:21 UTC
Permalink
Carlos:

Thanks for reply.
A context menu (or contextual menu) appears with rigth click mouse (or
middle click) and offers a set of choices available. How can I add or
delete options
in this menu?
best regards

Carlos Noriega

LoB -Laboratory of Biophysics - USP

Av. Mello de Moraes, 65 CEP 05508-030 São Paulo/SP

University of São Paulo - Brazil

tlfn: 11-30918735 cel:11-69634011
Post by Carlos Pascual
Post by Carlos Noriega
1) sift.py works with other files (tools.py, plot.py, etc.), where I work
with the context menu to add or remove options
I do not understand this question. What do you want to do?
Post by Carlos Noriega
2) the tool annotatedSegmentTool shows distance in pixels, but I'm
looking
Post by Carlos Noriega
for where you store this result (numeric variable) to make a
conversion from pixels
in a real size of a photograph loaded
I haven't tried myself, but I guess what you need is
AnnotatedSegment.get_tr_length()
or get_text() or get_infos()
http://packages.python.org/guiqwt/reference.html#guiqwt.annotations.AnnotatedSegment
Post by Carlos Noriega
Thanks in advance
Carlos Noriega
LoB -Laboratory of Biophysics - USP
Av. Mello de Moraes, 65 CEP 05508-030 São Paulo/SP
University of São Paulo - Brazil
tlfn: 11-30918735 cel:11-69634011
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
Phone: +34 93 592 4428
+----------------------------------------------------+
Carlos Pascual
2011-11-24 12:39:29 UTC
Permalink
AFAIK, all the options in the context menu of guiqwt plots are associated to
"tools"
So you have to add/remove tool. Have a look on the guiqwt docs and in the
tools.py file of guiqwt source code.

Note, you can create your own tools. I do it in my extension of guiqwt for
taurus:
http://tango-cs.svn.sourceforge.net/viewvc/tango-
cs/gui/taurus/trunk/lib/taurus/qt/qtgui/extra_guiqwt/tools.py?revision=17889&view=markup

Finally, the menu itself is a PyQt4.Qt.QMenu, so if you want to go low-level,
you can get the menu object and add/remove QActions (but that should be the
last option)
Post by Carlos Noriega
Thanks for reply.
A context menu (or contextual menu) appears with rigth click mouse (or
middle click) and offers a set of choices available. How can I add or
delete options
in this menu?
best regards
Carlos Noriega
LoB -Laboratory of Biophysics - USP
Av. Mello de Moraes, 65 CEP 05508-030 São Paulo/SP
University of São Paulo - Brazil
tlfn: 11-30918735 cel:11-69634011
Post by Carlos Pascual
Post by Carlos Noriega
1) sift.py works with other files (tools.py, plot.py, etc.), where I
work with the context menu to add or remove options
I do not understand this question. What do you want to do?
Post by Carlos Noriega
2) the tool annotatedSegmentTool shows distance in pixels, but I'm
looking
Post by Carlos Noriega
for where you store this result (numeric variable) to make a
conversion from pixels
in a real size of a photograph loaded
I haven't tried myself, but I guess what you need is
AnnotatedSegment.get_tr_length()
or get_text() or get_infos()
http://packages.python.org/guiqwt/reference.html#guiqwt.annotations.Annot
atedSegment
Post by Carlos Noriega
Thanks in advance
Carlos Noriega
LoB -Laboratory of Biophysics - USP
Av. Mello de Moraes, 65 CEP 05508-030 São Paulo/SP
University of São Paulo - Brazil
tlfn: 11-30918735 cel:11-69634011
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
Phone: +34 93 592 4428
+----------------------------------------------------+
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
Russ
2011-11-25 18:28:11 UTC
Permalink
You want to configure the Anotation tool's transform_matrix which is
located in the annotationparam property of the Annotated item,
You set the 'create_shape' function to your own for the tool you want
in your overridden "register_tools" function, 'create_shape' is called
when the tool is created, so it gives you a chance to set things up
the way you want.

def create_seg_shape(self):
print 'create_seg_shape:'
ap = AnnotationParam()
ap.title = '%s %d' % (SPATIAL_TYPE_PREFIX[SEG], self.segNum)
ap.transform_matrix = [[ 5.0, 0.0, 0.0],[ 0.0, 10.0, 0.0],
[ 0.0, 0.0, 1.0]]
ap.format = '%5.2f um'
return AnnotatedSegment(0, 0, 1, 1, annotationparam = ap), 0,
2

def register_tools(self):
ast = AnnotatedSegmentTool
ast.create_shape = self.create_seg_shape
aa = self.add_tool(ast, setup_shape_cb=self.setupsegment,
handle_final_shape_cb=self.newsegment)
aa.TITLE = _("Seg 0")

-Russ
~~~~~~~~~
Russ Berg Software & Controls
e-mail:russ.berg-***@public.gmane.org Canadian Light Source
Carlos Noriega
2011-11-28 21:08:55 UTC
Permalink
Rus:
thanks a lot, excuse the delay in responding but I was very sick (weekend)
and now I can just test the recommendations
best regards

Carlos Noriega

LoB -Laboratory of Biophysics - USP

Av. Mello de Moraes, 65 CEP 05508-030 São Paulo/SP

University of São Paulo - Brazil

tlfn: 11-30918735 cel:11-69634011
Post by Russ
You want to configure the Anotation tool's transform_matrix which is
located in the annotationparam property of the Annotated item,
You set the 'create_shape' function to your own for the tool you want
in your overridden "register_tools" function, 'create_shape' is called
when the tool is created, so it gives you a chance to set things up
the way you want.
print 'create_seg_shape:'
ap = AnnotationParam()
ap.title = '%s %d' % (SPATIAL_TYPE_PREFIX[SEG], self.segNum)
ap.transform_matrix = [[ 5.0, 0.0, 0.0],[ 0.0, 10.0, 0.0],
[ 0.0, 0.0, 1.0]]
ap.format = '%5.2f um'
return AnnotatedSegment(0, 0, 1, 1, annotationparam = ap), 0,
2
ast = AnnotatedSegmentTool
ast.create_shape = self.create_seg_shape
aa = self.add_tool(ast, setup_shape_cb=self.setupsegment,
handle_final_shape_cb=self.newsegment)
aa.TITLE = _("Seg 0")
-Russ
~~~~~~~~~
Russ Berg Software & Controls
Loading...