Jeremy Sanders | 3 Apr 2012 23:01
Gravatar

ANN: Veusz 1.15

I'm pleased to announce Veusz 1.15. Apologies for the long time it has 
taken to get this release out of the door.

Veusz 1.15
----------
Velvet Ember Under Sky Zenith
-----------------------------
http://home.gna.org/veusz/

Copyright (C) 2003-2012 Jeremy Sanders <jeremy@...>
and contributors.

Licenced under the GPL (version 2 or greater).

Veusz is a Qt4 based scientific plotting package. It is written in
Python, using PyQt4 for display and user-interfaces, and numpy for
handling the numeric data. Veusz is designed to produce
publication-ready Postscript/PDF/SVG output. The user interface aims
to be simple, consistent and powerful.

Veusz provides a GUI, command line, embedding and scripting interface
(based on Python) to its plotting facilities. It also allows for
manipulation and editing of datasets. Data can be captured from
external sources such as Internet sockets or other programs.

Changes in 1.15:
  * Improved hatching:
     - More hatch styles
     - Adjust spacing of hatching
     - Change hatching line style
(Continue reading)

Junkshops | 5 Apr 2012 19:47
Picon

Dataset namespaces

Hi Jeremy and all,

I'm wondering how difficult it would be to add dataset namespaces. 
Currently if a file is imported with a data row/column label that's the 
same as a data label in a previously imported file, the new data 
row/column will clobber the old one from the previous file. In the use 
case of multiple experimental conditions resulting in files with the 
same format, that means the researcher has to go into each file and add 
some sort of unique id to the label of each row of data if he or she 
wants to display multiple datasets in the same Veusz graph. 
Additionally, if two imported files usually have different labels but in 
rare cases have the same label, one of the data sets will clobber the 
other without the researcher knowing it (no error or warning occurs - 
the old data is silently overwritten).

Hence if the data labels from one file could have namespaces designated 
by the user, perhaps defaulting to the filenames, it could be very 
useful for researchers dealing with data in multiple files. I'm not sure 
how much reworking of the code that might take though - could be 
substantial. Anyway, just a suggestion - but I would at minimum advocate 
warning a user if his or her data is going to be overwritten.

Cheers, Gavin
Steve Richardson | 5 Apr 2012 20:06
Picon

Re: Dataset namespaces

Hi Gavin,

I agree that having a warning would be very helpful.  I've found a
workaround, though, that's helpful for me and might be helpful for
you, too.  In the import data window, under "General Options", I add a
prefix (or suffix) that signifies which file the data is coming from.
I make the prefix unique, and thus my imported data never gets
overwritten.

Steve

On Thu, Apr 5, 2012 at 1:47 PM, Junkshops <junkshops@...> wrote:
> Hi Jeremy and all,
>
> I'm wondering how difficult it would be to add dataset namespaces. Currently
> if a file is imported with a data row/column label that's the same as a data
> label in a previously imported file, the new data row/column will clobber
> the old one from the previous file. In the use case of multiple experimental
> conditions resulting in files with the same format, that means the
> researcher has to go into each file and add some sort of unique id to the
> label of each row of data if he or she wants to display multiple datasets in
> the same Veusz graph. Additionally, if two imported files usually have
> different labels but in rare cases have the same label, one of the data sets
> will clobber the other without the researcher knowing it (no error or
> warning occurs - the old data is silently overwritten).
>
> Hence if the data labels from one file could have namespaces designated by
> the user, perhaps defaulting to the filenames, it could be very useful for
> researchers dealing with data in multiple files. I'm not sure how much
> reworking of the code that might take though - could be substantial. Anyway,
(Continue reading)

Viktor Schroeder | 8 Apr 2012 17:12
Picon

Change tick labels from comma to dots

Hello!

I really like using veusz. But I need dots in the tick labels at the
axis. At the moment I have commas. How do I change that?

Best, Viktor 
schnumbl _ | 8 Apr 2012 23:12
Picon
Favicon

New equation editor project - Integration with Veusz?

Hi together,

I just started a project for a Python equation editor:

http://sourceforge.net/projects/ikwed/

If the basic functionality of Ikwed is working some day, I would like
to integrate it with Veusz. My vision of Ikwed is not only to be
an equation editor that supports several math formats but also
to be a GUI for calculations with sympy.

The best integration with Veusz would work in both directions:

- Add Ikwed-Equations as labels to Veusz plots

- Use Veusz plots in the equation editor/calculation notepad to visualize calculation results

What do you think is the best strategy to achieve this?
Should the equation editor be developed as Veusz-Plugin and extend
Veusz some day to be a general math tool like MathCad?

Or would it be better if Ikwed is developed as independent application?
What requirements should a stand alone application fullfill
to be easily integrated in Veusz to add labels?

At the time of writing this, I see that Veusz is hosted at gna.org.
Should I change from sourgeforge to gna?

Sunny regards,

Stefan
#!/usr/bin/python
# -*- coding: utf-8 -*-



import sys

from PyQt4 import QtCore
from PyQt4.QtCore import *
from PyQt4 import QtGui
from PyQt4 import QtSvg

        
class ikwed_atom(QtGui.QFrame):
    
    def __init__(self, ParentWidget, SvgString=""):
        super(ikwed_atom, self).__init__(ParentWidget)
                
        #some basic properties
        self.ikwed_Type = "default"
        self.ikwed_level = 0
        self.ikwed_sizefact = 1
        self.ikwed_orientationToParent = "default"
        self.ikwed_indexToParent = -1        
        self.ikwed_BackgroundColor=QtGui.QColor(255,255,255)
        
        #array for children ikwed atoms
        self.ikwed_children = []
        
        #Map for the child indice at 0:northwest, 1:west, 2:southwest, 
        #                            3:north,     4:(svg) 5:south, 
        #                            6:northeast, 7:east, 8:southeast
        #it helps to find the rigth tab order
        self.ikwed_orientationMap = [-1, -1, -1, -1, -1, -1, -1, -1, -1]                
         
        #Activate drag & drop and key focus        
        self.setAcceptDrops(True)
        self.dragging = False
        self.setFocusPolicy(Qt.StrongFocus)
        
        #svg element: the "heart" of the ikwed atom
        self.ikwed_svgString = SvgString           
        self.ikwed_svg=QtSvg.QSvgWidget(self) 
        self.ikwed_svg.setParent(self)
        self.ikwed_svg.setFocusPolicy(Qt.NoFocus)
        
        self.ikwed_svg_x = 0
        self.ikwed_svg_y = 0
        self.ikwed_svg_width = 0
        self.ikwed_svg_height = 0       
        self.ikwed_setSvgString(SvgString)        
       
        #position and size
        self.ikwed_x = 0
        self.ikwed_y = 0
        self.ikwed_width = self.ikwed_svg_width
        self.ikwed_height = self.ikwed_svg_height        
               
        #drop Box that shows where a new child would be added       
        self.ikwed_dropBox = QtSvg.QSvgWidget(self)
        self.ikwed_dropBox.setAcceptDrops(False)
        self.ikwed_dropBox.setFocusPolicy(Qt.NoFocus)
        
        #cursor
        self.ikwed_cursor = QtSvg.QSvgWidget(self)
        self.ikwed_cursor.setAcceptDrops(False)
        self.ikwed_cursor.setFocusPolicy(Qt.NoFocus)
        
        #text properties 
        self.ikwed_Text = ""           
        self.ikwed_FontSize = 10
        self.ikwed_FontStyle = "normal"
        self.ikwed_FontWeight = "normal"
        self.ikwed_LetterSpacing = 0
        self.ikwed_WordSpacing = 0
        self.ikwed_Fill = "#000000"
        self.ikwed_FillOpacity = 1
        self.ikwed_Stroke = "none"
        self.ikwed_FontFamily = "Arial"
        self.ikwed_TextScale = 1    
        self.ikwed_TextPosition = 0
    
    def ikwed_setSvgString(self, SvgString="", width=-1, height=-1):
        #this function updates the svg element with a new svg content
        
        #save old size information
        oldwidth = self.ikwed_svg_width
        oldheight = self.ikwed_svg_height
        
        #change svg element
        self.ikwed_svgString = SvgString
        if SvgString != "":
            self.ikwed_svg.load(QByteArray(self.ikwed_svgString))  
            self.ikwed_svg_width = self.ikwed_svg.__sizeof__()        
            self.ikwed_svg_height = self.ikwed_svg.heightForWidth(self.ikwed_svg_width)
            if width<>-1:
                self.ikwed_svg_width = width
            if height<>-1:
                self.ikwed_svg_height = height
        else:
            self.ikwed_svg_width = 0
            self.ikwed_svg_height = 0  
           
        self.ikwed_svg.resize(self.ikwed_svg_width, self.ikwed_svg_height)  
        
        #update layout if size of svg element was changed
        dx = self.ikwed_svg_width-oldwidth
        dy = self.ikwed_svg_height-oldheight
        if (dx <> 0  or dy <> 0):
            for child in self.ikwed_children:
                orientation = child.ikwed_orientationToParent
                if orientation == 'east':
                    child.ikwed_x = child.ikwed_x+dx
                    child.ikwed_y = child.ikwed_y+dy/2                                        
                elif orientation == 'west':
                    child.ikwed_x = child.ikwed_x
                    child.ikwed_y = child.ikwed_y+dy/2
                elif orientation == 'north':
                    child.ikwed_x = child.ikwed_x+dx/2
                    child.ikwed_y = child.ikwed_y     
                elif orientation == 'south':
                    child.ikwed_x = child.ikwed_x+dx/2
                    child.ikwed_y = child.ikwed_y+dy
                elif orientation == 'northeast':
                    child.ikwed_x = child.ikwed_x+dx
                    child.ikwed_y = child.ikwed_y
                elif orientation == 'northwest':
                    child.ikwed_x = child.ikwed_x
                    child.ikwed_y = child.ikwed_y
                elif orientation == 'southeast':
                    child.ikwed_x = child.ikwed_x+dx
                    child.ikwed_y = child.ikwed_y+dy   
                elif orientation == 'southwest':
                    child.ikwed_x = child.ikwed_x
                    child.ikwed_y = child.ikwed_y+dy   
                    
                child.ikwed_move(child.ikwed_x,child.ikwed_y)
                
            self.ikwed_updateLayout()
               
       
    def ikwed_scaleText(self, scale=1):
        #this function scales the text size
        if self.ikwed_Type == "text":
            self.ikwed_setText( self.ikwed_Text, \
                              self.ikwed_FontSize, \
                              self.ikwed_FontStyle, \
                              self.ikwed_FontWeight, \
                              self.ikwed_LetterSpacing, \
                              self.ikwed_WordSpacing, \
                              self.ikwed_Fill, \
                              self.ikwed_FillOpacity, \
                              self.ikwed_Stroke, \
                              self.ikwed_FontFamily, \
                              self.ikwed_TextScale*scale 
                              )
        
    def ikwed_setText(self, TextString = "", \
                      FontSize = 10, \
                      FontStyle = "normal", \
                      FontWeight = "normal", \
                      LetterSpacing = 0, \
                      WordSpacing = 0, \
                      Fill = "#000000", \
                      FillOpacity = 1, \
                      Stroke = "none", \
                      FontFamily = "Arial", \
                      TextScale = 1
                ):        
        #save TextString and TextStyle
        self.ikwed_Text = TextString   
        if self.ikwed_Type == "default":
            #init text position the first time ikwed_setText is called
            self.ikwed_TextPosition = len(TextString)
       
        self.ikwed_FontSize = FontSize
        self.ikwed_FontStyle = FontStyle
        self.ikwed_FontWeight = FontWeight
        self.ikwed_LetterSpacing = LetterSpacing
        self.ikwed_WordSpacing = WordSpacing
        self.ikwed_Fill = Fill
        self.ikwed_FillOpacity = FillOpacity
        self.ikwed_Stroke = Stroke
        self.ikwed_FontFamily = FontFamily
        self.ikwed_TextScale = TextScale
        
        
        #set atom type
        self.ikwed_Type = "text"
                    
        #translate FontWeight from svg to python            
        MyWeight = {
            "lighter": 25,
             "normal": 50,
               "bold": 75,
             "bolder": 87
            }[FontWeight]
        #translate FontStyle from svg to python
        MyItalic = {
             "normal": False,
             "italic": True,
            }[FontStyle]       

        
        #calculate text size    
        MyFont = QtGui.QFont(FontFamily)        
        MyFont.setPointSize(self.ikwed_FontSize)
        MyFont.setWeight(MyWeight)
        MyFont.setItalic(MyItalic)
        MyFont.setLetterSpacing(0, LetterSpacing)
        MyFont.setWordSpacing(WordSpacing)        
        
        self.setFont(MyFont)
        MyFontMetrics = self.fontMetrics()        
        pxWidth = MyFontMetrics.width(TextString)       
        pxHeight = MyFontMetrics.height() 
        
        SvgWidth = pxWidth * 1.202      
        SvgHeight = pxHeight 
              
        SvgTextString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "\n" +\
                 "<svg>" + "\n" +\
                 " <text" + "\n" +\
                 "   x=\"0\"" + "\n" +\
                 "   y=\""+ str(SvgHeight/1.3) + "\"" +\
                 "   transform=\"scale(" + str(TextScale) + "," + str(TextScale) + ")\"" +\
                 ">" + "\n" +\
                 "   <tspan " +\
                         " style=\"" + \
                                        "font-size:" + str(SvgHeight) + "px;"+\
                                      "font-family:" + FontFamily + ";" +\
                                       "font-style:" + FontStyle + ";"+\
                                      "font-weight:" + FontWeight + ";"+\
                                   "letter-spacing:" + str(LetterSpacing) +"px;"+\
                                     "word-spacing:" + str(WordSpacing) + "px;"+\
                                             "fill:" + Fill + ";"+\
                                     "fill-opacity:" + str(FillOpacity)+ ";"+\
                                      "stroke:" + Stroke + ""+\
                                "\"" +\
                          ">" + TextString + "</tspan>" + "\n" +\
                 "</text>" + "\n" +\
                 "</svg>"      
        self.ikwed_setSvgString(SvgTextString,SvgWidth*TextScale,SvgHeight*TextScale)
       
    def ikwed_setBackgroundColor(self, Color = QtGui.QColor('white')):  
        self.setAutoFillBackground(True)
        self.BackgroundColor=Color
        MyPalette = QtGui.QPalette(self.palette())        
        MyPalette.setColor(QtGui.QPalette.Background, self.BackgroundColor)
        self.setPalette(MyPalette)
        
    def ikwed_getBackgroundColor(self):
        return self.BackgroundColor    
        
    def ikwed_setBackgroundColorRgb(self, r=255,g=255,b=255):  
        self.setAutoFillBackground(True)
        self.BackgroundColor=QtGui.QColor(r,g,b)
        MyPalette = QtGui.QPalette(self.palette())        
        MyPalette.setColor(QtGui.QPalette.Background, self.BackgroundColor)
        self.setPalette(MyPalette)
        
    def ikwed_getBackgroundColorRgb(self):
        return self.BackgroundColor.getRgb()
        
    def ikwed_highlight(self, switch=True, Color = QtGui.QColor(51,153,255)):  
        self.setAutoFillBackground(True)
        if switch: 
            BackgroundColor = Color
        else:            
            BackgroundColor = self.ikwed_BackgroundColor
            
        MyPalette = QtGui.QPalette(self.palette())        
        MyPalette.setColor(QtGui.QPalette.Background, BackgroundColor)
        self.setPalette(MyPalette)
        
    def ikwed_highlightRgb(self, switch=True, r=51, g=153, b = 255): 
        self.setAutoFillBackground(True)
        if switch:             
            BackgroundColor = QtGui.QColor(r,g,b)
        else:
            BackgroundColor = self.ikwed_BackgroundColor
            
        MyPalette = QtGui.QPalette(self.palette())        
        MyPalette.setColor(QtGui.QPalette.Background, BackgroundColor)
        self.setPalette(MyPalette)
        
    def ikwed_showBorder(self, color = "red"):
        self.setStyleSheet("color:" + color)
        self.setFrameStyle(1)
        
    def ikwed_hideBorder(self):
        self.setFrameStyle(0)
        
    def ikwed_showDropBox(self,orientation='east'):
        self.ikwed_x = self.pos().x()
        self.ikwed_y = self.pos().y()
        width=self.ikwed_width
        height=self.ikwed_height
        boxsize = max(min(width,height)/10, 4)  
        if orientation == 'east':            
            x = width - boxsize
            y = height/2 - boxsize/2
        elif orientation == 'west':
            x = 0
            y = height/2 - boxsize/2
        elif orientation == 'north':
            x = width/2 - boxsize/2
            y = 0         
        elif orientation == 'south':
            x = width/2 - boxsize/2
            y = height - boxsize  
        elif orientation == 'northeast':
            x = width - boxsize
            y = 0
        elif orientation == 'northwest':
            x = 0
            y = 0 
        elif orientation == 'southeast':
            x = width - boxsize
            y = height - boxsize   
        elif orientation == 'southwest':
            x = 0
            y = height - boxsize           
            
        #create svg content that represnts the drop box
        box_SvgString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "\n" +\
        "<svg>    " + "\n" +\
        "   " + "\n" +\
        "  <rect" + "\n" +\

"style=\"opacity:1;color:#000000;fill:\#ff0000;fill-opacity:1;stroke:none;stroke-width:2.9330000877;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate\""
+ "\n" +\
        "id=\"rect2989\"" + "\n" +\
        "width=\"3.74570441246\"" + "\n" +\
        "height=\"2.61168384552\"" + "\n" +\
        "x=\"1.13402056694\"" + "\n" +\
        "y=\"1.95876288414\" />" + "\n" +\
        "</svg>"
        
        #load the svg content to the drop box object
        self.ikwed_dropBox.load(QByteArray(box_SvgString))
        
        #resize the drop box and move it the target position
        self.ikwed_dropBox.resize(boxsize,boxsize)
        self.ikwed_dropBox.move(x,y)
        
        #show a (red) border to indicate the current size of the target ikwed atom
        self.ikwed_showBorder()
             
    def ikwed_hideDropBox(self):        
        self.ikwed_dropBox.load(QByteArray(""))
        self.ikwed_hideBorder()
        
    def ikwed_showCursor(self, TextPosition = 0):
        #this function shows a curser to indicate the current position in the
        #text of the svg element
        
        #get cursor height
        cursorHeight=self.ikwed_svg_height

        #create svg content that represnts the cursor            
        cursor_SvgString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "\n" +\
        "<svg>    " + "\n" +\
        "   " + "\n" +\
        "  <rect" + "\n" +\

"style=\"opacity:1;color:#000000;fill:\#00ff00;fill-opacity:1;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate\""
+ "\n" +\
        "id=\"cursor\"" + "\n" +\
        "width=\"1\"" + "\n" +\
        "height=\"1\"" + "\n" +\
        "x=\"0\"" + "\n" +\
        "y=\"0\" />" + "\n" +\
        "</svg>"
        
        #load the svg content to the cursor object
        self.ikwed_cursor.load(QByteArray(cursor_SvgString))
        
        #set the cursor height (and width)
        self.ikwed_cursor.resize(1,cursorHeight)
        
        #calculate cursor x-coordinate from the size of the leading text
        
        #get leading text
        leadingText = self.ikwed_Text[:TextPosition]
        
        #translate FontWeight from svg to python            
        MyWeight = {
            "lighter": 25,
             "normal": 50,
               "bold": 75,
             "bolder": 87
            }[self.ikwed_FontWeight]
        #translate FontStyle from svg to python
        MyItalic = {
             "normal": False,
             "italic": True,
            }[self.ikwed_FontStyle]
        
        #calculate text size    
        MyFont = QtGui.QFont(self.ikwed_FontFamily)        
        MyFont.setPointSize(self.ikwed_FontSize)
        MyFont.setWeight(MyWeight)
        MyFont.setItalic(MyItalic)
        MyFont.setLetterSpacing(MyFont.letterSpacingType(), self.ikwed_LetterSpacing)
        MyFont.setWordSpacing(self.ikwed_WordSpacing)      
        self.setFont(MyFont)
        pxWidth = self.fontMetrics().width(leadingText)*1.201
        
        #calculate cursor x-coordinate
        x_cursor = max(0, pxWidth)
        x_cursor = min(x_cursor, self.ikwed_svg_width-1)
       
        #move cursor
        self.ikwed_cursor.move(self.ikwed_svg_x+x_cursor,self.ikwed_svg_y)
        
             
    def ikwed_hideCursor(self):        
        self.ikwed_cursor.load(QByteArray(""))
        
                    
    def ikwed_move(self,x,y):        
        self.move(x,y)
        self.ikwed_x = x
        self.ikwed_y = y
        
    def ikwed_add(self, child, orientation="default", childx=0, childy=0):  
        #save old size             
        width=self.ikwed_width
        height=self.ikwed_height
        
         #set properties of new child    
        index = len(self.ikwed_children) #index for new child
        child.ikwed_indexToParent = index
        child.ikwed_level = self.ikwed_level+1
        child.ikwed_orientationToParent = orientation   
                                                                 
        #add new child to the children array
        self.ikwed_children.append(child) 
        
        #set self as parent of new child and make it visible again 
        self.ikwed_children[index].setParent(self,Qt.Widget)
        self.ikwed_children[index].setVisible(True)
        
        #scale child to its original size in respect to basic panel as a starting point
        #for further scaling
        child.ikwed_scale(self.ikwed_sizefact/child.ikwed_sizefact)
        childwidth = child.ikwed_width 
        childheight = child.ikwed_height      
        
        #scale child according to its orientation 
        #also set the new position for the svg element
        #(the children will be moved to the right position by the function ikwed_updateLayout)
        svgx = 0        
        svgy = 0
        sizefact = 1
        
        if orientation == 'northwest':
            sizefact = 0.6
            svgx = childwidth
            svgy = childheight/2
        elif orientation == 'north':
            sizefact = 1
            svgx = max(0,childwidth-width)/2
            svgy = childheight      
        elif orientation == 'northeast':
            sizefact = 0.6
            svgx = 0
            svgy = childheight/2
        elif orientation == 'west':
            sizefact = 1
            svgx = childwidth
            svgy = max(0,(childheight-height)/2)
        elif orientation == 'east':  
            sizefact = 1            
            svgx = 0
            svgy = max(0,(childheight-height)/2) 
        elif orientation == 'southwest':
            sizefact = 0.6 
            svgx = childwidth
            svgy = 0
        elif orientation == 'south':
            sizefact = 1
            svgx = max(0,childwidth-width)/2
            svgy = 0                       
        elif orientation == 'southeast':
            sizefact = 0.6
            svgx = 0
            svgy = 0
                         
        #scale new child
        self.ikwed_children[index].ikwed_scale(sizefact) 
        
        #move svg 
        self.ikwed_svg_x = self.ikwed_svg_x + svgx
        self.ikwed_svg_y = self.ikwed_svg_y + svgy
        self.ikwed_svg.move(self.ikwed_svg_x, self.ikwed_svg_y) 
        
        #move all children to their right position in relation to the svg element,
        #resize the ikwed element and update the layout of its parents
        self.ikwed_updateLayout()
            
        
    def ikwed_removeByIndex(self, index = "end"):
        if index == "end":
            index = len(self.ikwed_children)-1
            
        #remove child from array    
        self.ikwed_children[index].close() 
        del self.ikwed_children[index]
        
        #update ikwed_indexToParent for all remaining children
        for k in range(0,len(self.ikwed_children)):
            self.ikwed_children[k].ikwed_indexToParent = k
        
        #update layout
        self.ikwed_updateLayout()
        
    def ikwed_removeByOrientation(self, orientation):        
        for child in self.ikwed_children:
            if child.ikwed_orientationToParent == orientation:
                self.ikwed_removeByIndex(child.ikwed_indexToParent)
                    
        
        
    def ikwed_updateLayout(self):
        #this function moves all children to the right possition in respect to
        #the position of the svg element, resizes this ikwed atom and updates
        #the layout of all parent ikwed atoms
        
        #get properties of svg element
        svgx = self.ikwed_svg_x
        svgy = self.ikwed_svg_y 
        svgwidth = self.ikwed_svg_width
        svgheight = self.ikwed_svg_height
        
        
        #update layout of this ikwed atom for gaps due to changed children sizes
        #also update orientationMap        
                
        self.ikwed_orientationMap = [-1, -1, -1, -1, -1, -1, -1, -1, -1]  
                
        for child in self.ikwed_children:
            childwidth = child.ikwed_width
            childheight = child.ikwed_height
            orientation = child.ikwed_orientationToParent
            index = child.ikwed_indexToParent
            
            if orientation == 'northwest':
                childx = svgx - childwidth
                childy = svgy - 0.5 * childheight
                self.ikwed_orientationMap[0] = index
            elif orientation == 'north':
                childx = svgx + svgwidth/2 - childwidth/2 
                childy = svgy - svgheight
                self.ikwed_orientationMap[3] = index
            elif orientation == 'northeast':
                childx = svgx + svgwidth
                childy = svgy - 0.5*childheight
                self.ikwed_orientationMap[6] = index
            elif orientation == 'west':
                childx = svgx - childwidth
                childy = svgy + svgheight/2 - childheight/2
                self.ikwed_orientationMap[1] = index
            elif orientation == 'east':  
                childx = svgx + svgwidth
                childy = svgy + svgheight/2 - childheight/2
                self.ikwed_orientationMap[7] = index                
            elif orientation == 'southwest':
                childx = svgx - childwidth
                childy = svgy + svgheight - 0.5*childheight  
                self.ikwed_orientationMap[2] = index
            elif orientation == 'south':
                childx = svgx + svgwidth/2 - childwidth/2
                childy = svgy + svgheight
                self.ikwed_orientationMap[5] = index
            elif orientation == 'southeast':
                childx = svgx + svgwidth 
                childy = svgy + svgheight - 0.5*childheight 
                self.ikwed_orientationMap[8] = index
                
            child.ikwed_move(childx,childy)
            
        #update tab order
        for k in range(0,len(self.ikwed_orientationMap)-1):
            if self.ikwed_orientationMap[k] > -1:
                #get this item--------------------------------------------------
                thisItem = self.ikwed_children[self.ikwed_orientationMap[k]]
                
                #get previous tab item------------------------------------------
                #case1: no previous item
                previousItem = -1
                #case2: previous item from previous ikwed atom
                if hasattr(self.previousInFocusChain().parent(), 'ikwed_x'):
                    previousItem = self.previousInFocusChain().parent()
                #case3: svg as previous item 
                if k > 4:
                    previousItem = self
                #case4: previous item is a child from this ikwed atom
                if k > 0:
                    previousIndex = self.ikwed_orientationMap[k-1]
                    if previousIndex > -1:
                        previousItem = self.ikwed_children[previousIndex]                 
                        
                #get next tab item----------------------------------------------
                #case1: no next item
                nextItem = -1
                #case2: svg as next item
                if k < 4:
                    nextItem = self
                #case3: next item is a child from this ikwed atom
                if k < len(self.ikwed_orientationMap)-1:
                    nextIndex = self.ikwed_orientationMap[k+1]
                    if nextIndex > -1:
                        nextItem = self.ikwed_children[nextIndex]
                #case4: next item from next ikwed atom: nothing to do
                        
                #set tab order--------------------------------------------------
                if previousItem <> -1:
                    self.setTabOrder(previousItem, thisItem)
                    
                if nextItem <> -1:
                    self.setTabOrder(thisItem, nextItem)
            
        #update layout of this ikwed atom for gaps due to (re)moved children
        xmin = svgx
        ymin = svgy
        xmax = svgx + svgwidth
        ymax = svgy + svgheight
        
        for child in self.ikwed_children:
            xmin = min(xmin, child.ikwed_x)
            ymin = min(ymin, child.ikwed_y)
            xmax = max(xmax, child.ikwed_x + child.ikwed_width)
            ymax = max(ymax, child.ikwed_y + child.ikwed_height)            
       
        self.ikwed_width = xmax-xmin
        self.ikwed_height = ymax-ymin
        self.resize(self.ikwed_width,self.ikwed_height)       
        
        self.ikwed_svg_x = svgx-xmin
        self.ikwed_svg_y = svgy-ymin
        self.ikwed_svg.move(self.ikwed_svg_x, self.ikwed_svg_y)
        
        for child in self.ikwed_children:            
            child.ikwed_move(child.ikwed_x-xmin,child.ikwed_y-ymin)       
            
        #update layout of parent ikwed atoms   
        if hasattr(self.parent(),'ikwed_updateLayout'):
            self.parent().ikwed_updateLayout()               
        
    def ikwed_scale(self, scale):   
        #this function scales an ikwed atom 
        self.ikwed_sizefact = self.ikwed_sizefact*scale
      
        self.ikwed_svg_x = scale*self.ikwed_svg_x
        self.ikwed_svg_y = scale*self.ikwed_svg_y        
        self.ikwed_svg.move(self.ikwed_svg_x, self.ikwed_svg_y)
                
        #scale text and move child objects that glue to the svg element
        self.ikwed_scaleText(scale)          
                        
        for child in self.ikwed_children:             
            if child.ikwed_orientationToParent == "default":
                #move childs that dont glue to the svg element
                child.ikwed_move(scale*child.ikwed_x,scale*child.ikwed_y)
            child.ikwed_scale(scale) 
            
        self.ikwed_updateLayout()
        
    def mouseMoveEvent(self, e):
        if e.buttons() != QtCore.Qt.LeftButton:
            return
        mimeData = QtCore.QMimeData()
        drag = QtGui.QDrag(self)
        drag.setMimeData(mimeData)
        drag.setHotSpot(e.pos() - self.rect().topLeft())
        drag.start(QtCore.Qt.MoveAction)   
        
    def mousePressEvent(self, e):
        #show border that indicates the active ikwed atom
        self.ikwed_showBorder("blue")
        
    def mouseReleaseEvent(self, e): 
        #hide (blue) border that indicated the active ikwed atom
        self.ikwed_hideBorder()
        
    def keyPressEvent(self, e): 
        #this function handels key events
        
        #get position of cursor in text        
        pos = self.ikwed_TextPosition
        
        #handle different types of key events
        if int(e.modifiers()) == (Qt.ControlModifier+Qt.AltModifier):
            #ctrl + alt as modivier
            if e.key() == Qt.Key_K:
                #when ctrl+alt+k is pressed, a message box should open
                print "ctrl+alt+k"
        else:  
            #no modiviers (also handles large charakters like A,B,C...)
            text = self.ikwed_Text #old text
            movePos = 0 #number of steps the curser is moved in the text
            
            if  (e.key() >= 32 and e.key() <38) or \
                (e.key() > 38 and e.key() <=126): 
                #"normal charackters"
                text = self.ikwed_Text[:pos] + str(e.text()) + self.ikwed_Text[pos:] 
                movePos = 1
            elif e.key() == 38:
                pass
                #&
            elif e.key() == 167:
                pass
                #§            
            elif e.key() == Qt.Key_Backspace:
                #delete charakter in front of the current position
                text = self.ikwed_Text[:pos-1] + self.ikwed_Text[pos:]
                movePos = -1
            elif e.key() == Qt.Key_Delete:                
                #delete charakter after the current position
                text = self.ikwed_Text[:pos] + self.ikwed_Text[pos+1:]
            elif e.key() == Qt.Key_Left:                
                #move left 
                movePos = -1  
            elif e.key() == Qt.Key_Right:                
                #move right 
                movePos = 1                           
            else:
                print e.key()       
 
            #update text of the svg element (and automtically update the layout) 
            self.ikwed_setText(text,\
                               self.ikwed_FontSize, \
                               self.ikwed_FontStyle, \
                               self.ikwed_FontWeight, \
                               self.ikwed_LetterSpacing, \
                               self.ikwed_WordSpacing, \
                               self.ikwed_Fill, \
                               self.ikwed_FillOpacity, \
                               self.ikwed_Stroke, \
                               self.ikwed_FontFamily, \
                               self.ikwed_TextScale)
                               
            #save the new cursor position                               
            self.ikwed_TextPosition = self.ikwed_TextPosition + movePos
            
            #flag that helps to show or hide the cursor
            insideFlag = 1
            
            #jump to next child or ikwed item if the cursor crosses the right limit of the text 
            #and hide the cursor in this text
            if self.ikwed_TextPosition < 0:                
                self.ikwed_TextPosition = 0                
                if hasattr(self.previousInFocusChain().parent(), "ikwed_x"):
                    insideFlag = 0
                    #self.previousInFocusChain().parent().setFocus()  
                    #simulate shift-tab key to go to the previous item in the tab order
                    QtCore.QCoreApplication.sendEvent(self.parent(), \
                    QtGui.QKeyEvent(QEvent.KeyPress, Qt.Key_Backtab, Qt.NoModifier, '')\
                    )
                    
            #jump to previous child or ikwed item if the cursor crosses the left limit of the text
            #and hide the cursor in this text
            if self.ikwed_TextPosition > len(self.ikwed_Text):
                self.ikwed_TextPosition = len(self.ikwed_Text)
                insideFlag = 0                
                #simulate tab key to go to the next item in the tab order
                QtCore.QCoreApplication.sendEvent(self, \
                QtGui.QKeyEvent(QEvent.KeyPress, Qt.Key_Tab, Qt.NoModifier, '')\
                    )
            
            #move the cursor to the new position
            if insideFlag == 1:
                self.ikwed_showCursor(self.ikwed_TextPosition)
            
    def dragEnterEvent(self, e):  
        #this event is fired if an object is dragged over an ikwed atom                 
        if e.source() != self:
            if self.ikwed_level == 0: 
                #only react to drag operations on main ikwed atoms (not being a child)
                e.accept()                
            else:
                e.ignore()
        else:
            #only react to drag operations if the target ikwed atom is different from the source 
            e.ignore()
            
    def dragMoveEvent(self, e):  
        #show a drop box while an object is dragged over a main ikwed atom (target) 
        #the drop box indicates where the new child (source) is added if the
        #mouse is released at the current position 
        
        if e.source() != self:
            e.accept()
            #get mouse coordinates
            mousex = e.pos().x()
            mousey = e.pos().y()   

            #show a drop box if the coordianates lie in the corresponding target regions 
            if mousex >= 0 and mousex <= self.width() and mousey >= 0 and mousey <= self.height():
                if mousex >= self.width()/3 and mousex <= self.width()*2/3 and mousey <= self.height()*2/3:
                    self.ikwed_showDropBox('north')
                elif mousex >= self.width()/3 and mousex <= self.width()*2/3 and mousey >= self.height()*2/3:
                    self.ikwed_showDropBox('south')
                elif mousex <= self.width()/3 and mousey >= self.height()/3 and mousey <= self.height()*2/3:
                    self.ikwed_showDropBox('west')
                elif mousex >= self.width()*2/3 and mousey >= self.height()/3 and mousey <= self.height()*2/3:
                    self.ikwed_showDropBox('east')     
                elif mousex < self.width()/3 and mousey < self.height()/3:
                    self.ikwed_showDropBox('northwest')     
                elif mousex < self.width()/3 and mousey > self.height()*2/3:                    
                    self.ikwed_showDropBox('southwest')                
                elif mousex > self.width()*2/3 and mousey < self.height()/3:
                    self.ikwed_showDropBox('northeast')
                elif mousex > self.width()*2/3 and mousey > self.height()*2/3:
                    self.ikwed_showDropBox('southeast')  
            else:
                #hide drop box if mouse coordinates are outside the target
                self.ikwed_hideDropBox()                
        else:
            #only react on movements if the target ikwed atom is different from the source ikwed atom
            e.ignore()
                              

    def dropEvent(self, e):   
        #add a new child to the target ikwed atom and
        #set the orientation of the new child according to the selected target region (which was indicated by
        #the drop box)
        
        #hide drop box
        self.ikwed_hideDropBox() 
        
        #get new child
        child = e.source()
        
        #hide (blue) border that marks the dragged child object
        child.ikwed_hideBorder()
        
        
        if child != self:
            #get mouse coordinates
            mousex = e.pos().x()
            mousey = e.pos().y()
            
            #remove child from its old parent if the parent is an ikwed atom
            if hasattr(child.parent(), 'ikwed_x'):
                oldOrientation = child.ikwed_orientationToParent
                child.parent().ikwed_removeByOrientation(oldOrientation) 
                
                
            #add child to this ikwed atom or the basic frame                    
            if mousex > 0 and mousex< self.ikwed_width and mousey > 0 and mousey < self.ikwed_height:
                #drop is inside borders of this ikwed atom, add it to this ikwed atom
                e.accept()                  
               
                if mousex >= self.width()/3 and mousex <= self.width()*2/3 and mousey <= self.height()*2/3:
                    self.ikwed_add(child,'north')                    
                elif mousex >= self.width()/3 and mousex <= self.width()*2/3 and mousey >= self.height()*2/3:
                    self.ikwed_add(child,'south')
                elif mousex <= self.width()/3 and mousey >= self.height()/3 and mousey <= self.height()*2/3:
                    self.ikwed_add(child,'west')
                elif mousex >= self.width()*2/3 and mousey >= self.height()/3 and mousey <= self.height()*2/3:
                    self.ikwed_add(child,'east')     
                elif mousex < self.width()/3 and mousey < self.height()/3:
                    self.ikwed_add(child,'northwest')     
                elif mousex < self.width()/3 and mousey > self.height()*2/3:                    
                    self.ikwed_add(child,'southwest')                
                elif mousex > self.width()*2/3 and mousey < self.height()/3:
                    self.ikwed_add(child,'northeast')
                elif mousex > self.width()*2/3 and mousey > self.height()*2/3:
                    self.ikwed_add(child,'southeast')
                else:
                    print "Error in dropEvent"
            else:
                #drop is outside the borders of this ikwed atom, add it to the basic frame
                e.accept()               
                                
                #scale child back to its original size (reset sizefact to 1)
                child.ikwed_scale(1/child.ikwed_sizefact) 
                
                #calculate new coordinates
                windowx = child.parent().pos().x()
                windowy = child.parent().pos().y()
                corrected_x= mousex - windowx - 8 
                corrected_y= mousey- windowy- 30
                
                #reset further properties
                child.ikwed_level = 0
                child.ikwed_orientationToParent = 'default'
                child.ikwed_indexToParent = -1
                
                #add child to basic frame
                #(drop actions are only allowd for main ikwed atoms => self.parent() is the basic frame)
                basicFrame = self.parent()
                child.setParent(basicFrame)                
                child.setVisible(True)
                
                #move it to the right position on the basic frame                 
                child.ikwed_move(corrected_x,corrected_y)
        else:    
            #only allow drops if the source ikwed atom is different from the target ikwed atom
            e.ignore()
        
    def dragLeaveEvent(self, e):         
        e.accept()      
        self.ikwed_hideDropBox()
        
    def focusInEvent(self, e):
        #show the curser when an ikwed atom gets keyboard focus
        self.ikwed_showCursor(self.ikwed_TextPosition)
        
    def focusOutEvent(self, e):
        #hide the curser when an ikwed atom loses keyboard focus 
        self.ikwed_hideCursor()
        

class Example(QtGui.QWidget):
    
    def __init__(self):
        super(Example, self).__init__()        
        self.initUI()
        
    def dragEnterEvent(self, e):        
        e.accept()
      
    def dropEvent(self, e):  
        #this function adds ikwed atoms to the basic frame if they are dropped there
        
        e.accept()
        
        #get ikwed atom
        ikwedAtom = e.source()
        
        #hide (blue) border that marks the dragged ikwed atom
        ikwedAtom.ikwed_hideBorder()
        
        #remove ikwedAtom from its old parent if the parent is an ikwed atom
        if hasattr(ikwedAtom.parent(), 'ikwed_x'):
            oldOrientation = ikwedAtom.ikwed_orientationToParent
            ikwedAtom.parent().ikwed_removeByOrientation(oldOrientation) 
        
        #scale ikwed atom back to its original size (reset sizefact to 1)
        ikwedAtom.ikwed_scale(1/ikwedAtom.ikwed_sizefact) 
        
        #reset further properties
        ikwedAtom.ikwed_level = 0
        ikwedAtom.ikwed_orientationToParent = 'default'
        ikwedAtom.ikwed_indexToParent = -1
        
        #add ikwed atom to basic frame       
        ikwedAtom.setParent(self)  
        ikwedAtom.setVisible(True)
        
        #move ikwed atom to the current mouse position on the basic frame
        mousex = e.pos().x()
        mousey = e.pos().y()
        ikwedAtom.ikwed_move(mousex,mousey)                 
        
    def initUI(self):
        
        self.setGeometry(300, 300, 800, 800)
        self.setWindowTitle('Ikwed')
        self.setWindowIcon(QtGui.QIcon('ikwed.svg'))  
        
        #Activate Drag and Drop        
        self.setAcceptDrops(True)
        
        #Set BackgroundColor
        colorstr = 'white'
        widget = self
        pal = QtGui.QPalette(widget.palette())        
        pal.setColor(QtGui.QPalette.Background, QtGui.QColor(colorstr))
        widget.setPalette(pal)  
        
        #self.setStyleSheet("border:3px solid rgb(122, 255, 0); ")
        
        
        curly_bracket_left = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "\n" +\
        "<svg>    " + "\n" +\
        "   " + "\n" +\
        "  <path" + "\n" +\
        "     style=\"fill:#000000;fill-opacity:1;stroke:none\"" + "\n" +\
        "     d=\"M 4,2.3737481 3.9905873,2 C 1.2451566,3.4868455 0.0373817,6.8776561 0,9.7371753 c
0.010932,-0.010207 1.3963834,0.00102 1.3963834,0.00102 0.02711,-2.6024085 0.3727145,-5.885674
2.5931241,-7.3644478 z\"" + "\n" +\
        "     id=\"path2997\"" + "\n" +\
        "     inkscape:connector-curvature=\"0\"" + "\n" +\
        "     sodipodi:nodetypes=\"cccccc\" />" + "\n" +\
        "  <path" + "\n" +\
        "     style=\"fill:#000000;fill-opacity:1;stroke:none\"" + "\n" +\
        "     d=\"m 3.9894873,17.353705 0.0011,0.373748 C 1.2451566,16.240607 0.0373817,12.849797 0,9.9902788
c 0.010932,0.01021 1.3963834,-0.001 1.3963834,-0.001 0.02711,2.6024072 0.3727145,5.8856732
2.5931241,7.3644462 z\"" + "\n" +\
        "     id=\"path2997-1\"" + "\n" +\
        "     inkscape:connector-curvature=\"0\"" + "\n" +\
        "     sodipodi:nodetypes=\"cccccc\" />" + "\n" +\
        "  <rect" + "\n" +\
        "    
style=\"color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate\""
+ "\n" +\
        "     id=\"rect3000\"" + "\n" +\
        "     width=\"1.3963852\"" + "\n" +\
        "     height=\"0.2718626\"" + "\n" +\
        "     x=\"0\"" + "\n" +\
        "     y=\"9.7310076\" />" + "\n" +\
        "</svg>"     
           
                      
        self.svg1 = ikwed_atom(self)   
        #self.ikwed_svg1.ikwed_setSvgString(curly_bracket_left)
        #self.ikwed_svg1.resize(100,30)                              
        #self.ikwed_svg1.setBackgroundColorRgb(125,125,125) 
                
        self.svg1.ikwed_setText("A", \
                          FontSize = 12, \
                          FontStyle = "normal", \
                          FontWeight = "normal", \
                          LetterSpacing = 0, \
                          WordSpacing = 0, \
                          Fill = "#0AA00", \
                          FillOpacity = 1, \
                          Stroke = "none", \
                          FontFamily = "Cooper Black", \
                          TextScale = 1)
        
        #self.svg1.ikwed_showBorder()
        #self.svg1.ikwed_highlight()
        self.svg1.ikwed_move(200,200)
        
                 
        self.svg3=ikwed_atom(self) #QtSvg.QSvgWidget(self)
        
        self.svg3.ikwed_setText("B", \
                          FontSize = 12, \
                          FontStyle = "normal", \
                          FontWeight = "normal", \
                          LetterSpacing = 0, \
                          WordSpacing = 0, \
                          Fill = "#0AA00", \
                          FillOpacity = 1, \
                          Stroke = "none", \
                          FontFamily = "Cooper Black")
                          
        #self.svg1.ikwed_add(self.svg3,'north')
           
   
        
        
        
        
        self.svg4=ikwed_atom(self) #QtSvg.QSvgWidget(self)
        
        self.svg4.ikwed_setText("C", \
                          FontSize = 12, \
                          FontStyle = "normal", \
                          FontWeight = "normal", \
                          LetterSpacing = 0, \
                          WordSpacing = 0, \
                          Fill = "#0AA00", \
                          FillOpacity = 1, \
                          Stroke = "none", \
                          FontFamily = "Cooper Black")
                          
        self.svg5=ikwed_atom(self) #QtSvg.QSvgWidget(self)
        
        self.svg5.ikwed_setText("D", \
                          FontSize = 12, \
                          FontStyle = "normal", \
                          FontWeight = "normal", \
                          LetterSpacing = 0, \
                          WordSpacing = 0, \
                          Fill = "#0AA00", \
                          FillOpacity = 1, \
                          Stroke = "none", \
                          FontFamily = "Cooper Black")
                          
        self.svg5.ikwed_add(self.svg1,'east')
        self.svg5.ikwed_add(self.svg3,'northeast')
        
        print len(self.svg5.ikwed_children)
        print self.svg5.ikwed_children[0].ikwed_Text
        print self.svg5.ikwed_children[0].ikwed_indexToParent
        
        print self.svg5.ikwed_children[1].ikwed_Text
        print self.svg5.ikwed_children[1].ikwed_indexToParent
        
        self.svg5.ikwed_removeByIndex(0)
        
        print self.svg5.ikwed_children[0].ikwed_Text
        print self.svg5.ikwed_children[0].ikwed_indexToParent
        
        
         
        self.show()
        
def main():
    
    app = QtGui.QApplication(sys.argv)
    #app.setOverrideCursor()

    ex = Example()
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()
_______________________________________________
Veusz-discuss mailing list
Veusz-discuss@...
https://mail.gna.org/listinfo/veusz-discuss
Jeremy Sanders | 9 Apr 2012 20:48
Gravatar

Re: New equation editor project - Integration with Veusz?

Hi Stefan

On 08/04/12 22:12, schnumbl _ wrote:

> The best integration with Veusz would work in both directions:
> - Add Ikwed-Equations as labels to Veusz plots
> - Use Veusz plots in the equation editor/calculation notepad to visualize calculation results
>
> What do you think is the best strategy to achieve this?
>
> Should the equation editor be developed as Veusz-Plugin and extend
>
> Veusz some day to be a general math tool like MathCad?

Thanks for letting us know. I hope your project succeeds.

I would keep the application modular enough that any integration could 
be improved or modified. Keep any integration code separated from the 
editor as much as possible. That way it could run as a separate 
application or as part of veusz. You could play with the editor 
separately and bring it in later.

I suspect that the current plugin system isn't powerful enough to make a 
proper or usable interface with veusz. It doesn't allow asynchronous 
communication or change the user interface. It might be interesting to 
improve the plugin system to allow changes the UI, though it gets hard 
to generalise this.

A tools plugin would probably be a starting point to manipulate the 
document using an external program. It probably requires some real code 
to link veusz and your app. DBus integration might be easy, though would 
be limited to Unix.

> Or would it be better if Ikwed is developed as independent application?

I suppose it depends on how closely you'd like it to integrate. Making 
it a Qt-based widget/window would allow it to be integrated later fairly 
easily at a later stage, if you wanted.

> What requirements should a stand alone application fullfill
>
> to be easily integrated in Veusz to add labels?

DBus could modify the document directly, or you could use a tools plugin 
to read or update the state of the remote program. Otherwise, you'll 
need to add some code to veusz to listen to commands from the external 
app and send data back to it. Sockets or pipes are a reasonable way to 
communicate. You could look at the embed.py/embed_remote.py scripts for 
inspiration.

The alternative is putting your code directly into veusz. If you app can 
draw equations nicely, this would allow veusz to directly use it for 
rendering. As I said, we can always do that later.

> At the time of writing this, I see that Veusz is hosted at gna.org.
>
> Should I change from sourgeforge to gna?

I don't think that is necessary. We're only using gna for the web page 
and mailing list. We use github for the source.

Please ask if you'd like some help with the veusz codebase...

Jeremy
Jeremy Sanders | 9 Apr 2012 20:49
Gravatar

Re: Change tick labels from comma to dots

Sorry... resent as used wrong from addresss...

On 08/04/12 16:12, Viktor Schroeder wrote:
> Hello!
>
> I really like using veusz. But I need dots in the tick labels at the
> axis. At the moment I have commas. How do I change that?
>
> Best, Viktor

Dear Viktor - This should be better documented

To do it on a per-document basis, you can select the "document" widget
(/), and in the formatting section, click the "English locale" checkbox.

To override it for all documents, go to Edit->Preferences. Click the
"Override system locale settings to show Veusz in US/English".

Jeremy
Patrick Durrell | 12 Apr 2012 17:59
Favicon

Question on objects plotted outside box/grid

I am plotting ellipses and circles (simply using `Add ellipse') over images plotted on traditional x- y- axes, but I find the ellipses/circles extend outside the axes.  I wanted to ask if someone knows how to keep that from happening (just to keep plotted objects inside the axes), in order to `clean up' the plot.  

    Veusz 1.14

  Pat Durrell

_______________________________________________
Veusz-discuss mailing list
Veusz-discuss@...
https://mail.gna.org/listinfo/veusz-discuss
Jeremy Sanders | 12 Apr 2012 18:22
Gravatar

Re: Question on objects plotted outside box/grid

On 12/04/12 16:59, Patrick Durrell wrote:
> I am plotting ellipses and circles (simply using `Add ellipse') over
> images plotted on traditional x- y- axes, but I find the
> ellipses/circles extend outside the axes.  I wanted to ask if someone
> knows how to keep that from happening (just to keep plotted objects
> inside the axes), in order to `clean up' the plot.  

Unfortunately the ellipse widget doesn't clip itself to the graph
bounds, as it was intended for highlighting things on a graph, rather
than plotting data. It and the line widget need a "clip" setting. It
should be very easy to fix this for the next release.

As a workaround, you'll have to simulate an ellipse, either by making
datasets plotting x = r * cos(t*2*pi) and y = r * sin(t*2*pi) - use
parametric dataset creation, or plotting two functions -sqrt( r**2 -
x**2 ) and sqrt( r**2- x**2).

Jeremy
romain | 17 Apr 2012 22:24
Favicon

using a dataset as an entry of a tool plugin?

Hi,

First of all, congratulations for this nice tool that is Veusz!
I have been looking for this kind of software for a long time.

I already made dataset plugins to modify data import from a water product
laboratory, especially to synchronize and filter datas stored separately
following timestamp value on csv files. By the way, the wiki page was a big help.

I'm now trying to add a tool plugin that modify widgets like shapes and lines,
according to the datasets I have imported. The goal is to automatically
visualize if the values imported follow or not special requirements (e.g.
maximum value and duration of a peak on a curve).
This is where I stumble because I'm trying to call datas from an existing
dataset inside the "apply" function of a tool plugin. Any tip one that matter?

Thanks

Romain

Gmane