Exemple #1
0
def GetKtSubView(subViewName): #obsolete, do not use it.
    view=GetKtView()
    print view
    """返回指定名称的subview,若没有则新建一个"""
    try:
        subView = kcs_draft.element_child_first_get(view)
        name = kcs_draft.subpicture_name_get(subView)
        if name == subViewName:
            return subView
        while True:
            subView = kcs_draft.element_sibling_next_get(subView)
            name = kcs_draft.subpicture_name_get(subView)
            if name == subViewName:
                return subView
    except:
        csm=CurrentSubpictureManager()
        csm.Set(view)
        subView = kcs_draft.subview_new(subViewName)
        csm.Back()
        return subView
Exemple #2
0
    def Draw(self):
        "draw the drawing form on current drawing"
        #check whether view exist
        hd = kcs_draft.subview_new('KT_FORM%s' % (self.Index))
        kcs_draft.subpicture_current_set(hd)
        hd = kcs_draft.component_new('FORM_CONTOUR')
        kcs_draft.subpicture_current_set(hd)

        #drawing form lines
        #outer rectangle
        lm = LineMaker(self.Location.X, self.Location.Y)
        lm.LineX(self.Width)
        lm.LineY(self.Height)
        lm.LineX(-self.Width)
        lm.LineY(-self.Height)
        #inner rectangle
        lm.Move(self.PaddingLeft, self.PaddingBottom)
        lm.LineX(self.Width - self.PaddingRight - self.PaddingLeft)
        lm.LineY(self.Height - self.PaddingBottom - self.PaddingTop)
        lm.LineX(-self.Width + self.PaddingRight + self.PaddingLeft)
        lm.LineY(-self.Height + self.PaddingBottom + self.PaddingTop)
        #onter lines
        lm.MoveTo(self.Location.X + self.PaddingLeft,
                  self.Location.Y + self.Height - self.PaddingTop - 13)
        lm.LineX(60)
        lm.LineY(13)
        lm.MoveTo(self.Location.X + self.Width - self.PaddingRight,
                  self.Location.Y + self.Height - self.PaddingTop - 13)
        lm.LineX(-14)
        lm.LineY(13)
        lm.MoveY(-13)
        lm.LineX(-46)
        lm.LineY(13)
        lm.MoveY(-13)
        lm.LineX(-65)
        lm.LineY(13)
        lm.Move(111, -13)
        lm.Line(14, 13)
Exemple #3
0
 def Draw(self):
     "Draw table on current drawing"
     if self.Handle==None:   #create a new view for this table
         #get the max index and create view
         tbViews=ktDraft.GetViews(r'^KT_TABLE_.\d*$')
         maxIndex=1
         if len(tbViews)>0:
             maxIndex=max([int(i[1][9:]) for i in tbViews])+1
         viewName='KT_TABLE_%s'%(maxIndex)
         self.Handle=kcs_draft.view_new(viewName)
         kcs_draft.subpicture_current_set(self.Handle)
         
         #create subview
         subName='KT%sX%s'%(self.NColumn,self.NRow)
         hdSub=kcs_draft.subview_new(subName)
         
         #create component for cells
         for c in self.Cells:
             kcs_draft.subpicture_current_set(hdSub)
             c.Draw()
     else:
         for c in self.Cells:
             c.Draw()
     kcs_draft.subpicture_current_set()