Beispiel #1
0
    def actionPerformed(self, actionEvent):
        try:
            draw = OOoDraw()
        except NotOOoDrawException:
              return

        sobj = draw.document.CurrentSelection

        if sobj:
            if sobj.Count > 0:
                obj = sobj.getByIndex(0)
                jport, d_type = JudgeDrawObjRTC(obj)
                if jport:
                    if d_type == "DataInPort":
                        OOoRTC.draw_comp.mRemoveInPort(jport)
                    else:
                        OOoRTC.draw_comp.mRemoveOutPort(jport)
                    ClearInfo(self.dlg_control)
                    MyMsgBox('',OOoRTC.SetCoding('削除しました','utf-8'))

                    UpdateSaveSheet()
                    return
                    
            
        
        
        MyMsgBox(OOoRTC.SetCoding('エラー','utf-8'),OOoRTC.SetCoding('削除済みです','utf-8'))
Beispiel #2
0
def createOOoWriterComp():
    if OOoRTC.writer_comp:
        MyMsgBox('',OOoRTC.SetCoding('RTCは起動済みです','utf-8'))
        return                    
    
    if OOoRTC.mgr == None:
        if os.name == 'posix':
            home = expanduser("~")
            OOoRTC.mgr = OpenRTM_aist.Manager.init([os.path.abspath(__file__), '-f', home+'/OOoRTC/rtc.conf'])
        elif os.name == 'nt':
            OOoRTC.mgr = OpenRTM_aist.Manager.init([os.path.abspath(__file__), '-f', '.\\rtc.conf'])
        else:
            return

      
        OOoRTC.mgr.setModuleInitProc(MyModuleInit)
        OOoRTC.mgr.activateManager()
        OOoRTC.mgr.runManager(True)
    else:
        MyModuleInit(OOoRTC.mgr)
      
          

    try:
      writer = OOoWriter()
    except NotOOoWriterException:
      return

    
    MyMsgBox('',OOoRTC.SetCoding('RTCを起動しました','utf-8'))


    
    
    return None
Beispiel #3
0
def UpdateTree(dlg_control, m_port):
    
    info_control = dlg_control.getControl( ControlName.TextFName )
    info_control.setText(OOoRTC.SetCoding('作成済み','utf-8'))

    dtcb_control = dlg_control.getControl( ControlName.DataTypeCBName )
    if len(m_port._port_a[0]) == 2:
        dtcb_control.setText(m_port._port_a[1])
    else:
        dtcb_control.setText("")
    
    xo_control = dlg_control.getControl( ControlName.XoffsetBName )
    xo_control.setText(str(m_port._ox))

    yo_control = dlg_control.getControl( ControlName.YoffsetBName )
    yo_control.setText(str(m_port._oy))

    ro_control = dlg_control.getControl( ControlName.RoffsetBName )
    ro_control.setText(str(m_port._or))

    xs_control = dlg_control.getControl( ControlName.XscaleBName )
    xs_control.setText(str(m_port._sx))

    ys_control = dlg_control.getControl( ControlName.YscaleBName )
    ys_control.setText(str(m_port._sy))
Beispiel #4
0
  def setWord(self, m_str):
      cursor = self.writer.document.getCurrentController().getViewCursor()

      inp_str = OOoRTC.SetCoding(m_str, self.conf_Code[0])
      cursor.setString(inp_str)
      
      cursor.CharHeight = self.fontSize
      cursor.CharHeightAsian = self.fontSize

      

      if self.bold:
          cursor.CharWeight = BOLD
          cursor.CharWeightAsian = BOLD
      else:
          cursor.CharWeight = FW_NORMAL
          cursor.CharWeightAsian = FW_NORMAL
      if self.italic:
          cursor.CharPosture = ITALIC
          cursor.CharPostureAsian = ITALIC
      else:
          cursor.CharPosture = FS_NONE
          cursor.CharPostureAsian = FS_NONE

      if self.underline:
          cursor.CharUnderline = FU_SINGLE
      else:
          cursor.CharPosture = FU_NONE
          

      if self.strikeout:
          cursor.CharStrikeout = FST_SINGLE
      else:
          cursor.CharStrikeout = FST_NONE

      if self.emphasis:
          cursor.CharEmphasis = 1
      else:
          cursor.CharEmphasis = 0

      cursor.CharShadowed = self.shadow

      cursor.CharContoured = self.contoured
          

        

      #cursor.CharStyleName = self.fontName

      cursor.CharColor = OOoRTC.RGB(self.char_Red,self.char_Green,self.char_Blue)
      cursor.CharBackColor = OOoRTC.RGB(self.back_Red,self.back_Green,self.back_Blue)

      cursor.goRight(len(inp_str),False)

      cursor.collapseToEnd()
Beispiel #5
0
 def actionPerformed(self, actionEvent):
     
     objectTree = self.dlg_control.getControl(ControlName.RTCTreeName)
     
     t_comp, nd = OOoRTC.JudgePort(objectTree, self._paths)
     
     if t_comp:
         
         for n,i in OOoRTC.draw_comp.InPorts.items():
             if i._port_a[0] == t_comp[0]:
                 i._obj.RotateAngle = i._r
                 t_pos = Point()
                 t_pos.X = i._x
                 t_pos.Y = i._y
                 i._obj.setPosition(t_pos)
                 return
     else:
         MyMsgBox(OOoRTC.SetCoding('エラー','utf-8'),OOoRTC.SetCoding('データポートを選択してください','utf-8'))
         return
     
     MyMsgBox(OOoRTC.SetCoding('エラー','utf-8'),OOoRTC.SetCoding('削除済みです','utf-8'))
Beispiel #6
0
    def selectionChanged(self, ev):
        try:
            draw = OOoDraw()
        except NotOOoDrawException:
            return

        sobj = draw.document.CurrentSelection
        
        if sobj:
            if sobj.Count > 0:
                obj = sobj.getByIndex(0)
                jport, d_type = JudgeDrawObjRTC(obj)

                
                
                if jport:
                    UpdateTree(self.dlg_control, jport)
                    return
        else:
            return

        info_control = self.dlg_control.getControl( ControlName.TextFName )
        info_control.setText(OOoRTC.SetCoding('未作成','utf-8'))
Beispiel #7
0
    def actionPerformed(self, actionEvent):

        

        try:
            draw = OOoDraw()
        except NotOOoDrawException:
            return

        sobj = draw.document.CurrentSelection

        if sobj:
            if sobj.Count > 0:
                obj = sobj.getByIndex(0)
                
                jport, d_type = JudgeDrawObjRTC(obj)
                
                if jport:
                    xo_control = self.dlg_control.getControl( ControlName.XoffsetBName )
                    yo_control = self.dlg_control.getControl( ControlName.YoffsetBName )
                    ro_control = self.dlg_control.getControl( ControlName.RoffsetBName )
                    xs_control = self.dlg_control.getControl( ControlName.XscaleBName )
                    ys_control = self.dlg_control.getControl( ControlName.YscaleBName )
                    jport._ox = long(xo_control.Text)
                    jport._oy = long(yo_control.Text)
                    jport._or = float(ro_control.Text)
                    jport._sx = long(xs_control.Text)
                    jport._sy = long(ys_control.Text)
                    UpdateSaveSheet()

                    return

                dtcb_control = self.dlg_control.getControl( ControlName.DataTypeCBName )
                dt = str(dtcb_control.Text)
                if dt != "":
                    F_Name = dt + str(OpenRTM_aist.uuid1())
                    ptcb_control = self.dlg_control.getControl( ControlName.PortTypeCBName )
                    pt = str(ptcb_control.Text)
                    

                    for d in DrawDataPort.DataType.DataTypeList:
                        if dt == d:
                            dt = d
                    
                    if pt == "DataOutPort":
                        pt = "DataInPort"
                    else:
                        pt = "DataOutPort"
                    CompAddPort(F_Name, [[pt,dt],dt], self.dlg_control, obj, pt, False)
                    if pt == "DataInPort":
                        MyMsgBox('',OOoRTC.SetCoding(dt+"型のOutPortを作成しました。",'utf-8'))
                    else:
                        MyMsgBox('',OOoRTC.SetCoding(dt+"型のInPortを作成しました。",'utf-8'))
                    UpdateSaveSheet()

                    info_control = self.dlg_control.getControl( ControlName.TextFName )
                    info_control.setText(OOoRTC.SetCoding('作成済み','utf-8'))

                    return
                    
                    
                objectTree = self.dlg_control.getControl(ControlName.RTCTreeName)
                t_comp, nd = OOoRTC.JudgePort(objectTree, self._paths)
                
                
                if t_comp:
                    
                    m_i,m_j = JudgeRTCObjDraw(obj)
                    
                    F_Name = t_comp[0][-2] + t_comp[0][-1] + str(m_i) + str(m_j)
                    
                    
                    profile = t_comp[1].get_port_profile()
                    props = nvlist_to_dict(profile.properties)

                    
                    CompAddPort(F_Name, t_comp, self.dlg_control, obj, props['port.port_type'])
                    
                        
                    t_str = str(m_i) + "ページの" +  str(m_j) + "番目の図形と" + t_comp[0][-2] + t_comp[0][-1] + "を関連付けました"
                    MyMsgBox('',OOoRTC.SetCoding(t_str,'utf-8'))
                        
                        

                    

                    UpdateSaveSheet()

                    info_control = self.dlg_control.getControl( ControlName.TextFName )
                    info_control.setText(OOoRTC.SetCoding('作成済み','utf-8'))
Beispiel #8
0
def ClearInfo(dlg_control):
    info_control = dlg_control.getControl( ControlName.TextFName )
    info_control.setText(OOoRTC.SetCoding('未作成','utf-8'))
Beispiel #9
0
def SetDialog():
    try:
      draw = OOoDraw()
    except NotOOoDrawException:
        return
      
    sobj = draw.document.CurrentSelection
    if sobj == None:
        MyMsgBox(OOoRTC.SetCoding('エラー','utf-8'), OOoRTC.SetCoding('図形を選択してください','utf-8'))
        return
    elif sobj.Count < 1:
        MyMsgBox(OOoRTC.SetCoding('エラー','utf-8'), OOoRTC.SetCoding('図形を選択してください','utf-8'))
        return

  
    dialog_name = "OOoDrawControlRTC.RTCTreeDialog"

    ctx = uno.getComponentContext()
    smgr = ctx.ServiceManager
    dp = smgr.createInstance("com.sun.star.awt.DialogProvider")
    dlg_control = dp.createDialog("vnd.sun.star.script:"+dialog_name+"?location=application")




    oTree = dlg_control.getControl(ControlName.RTCTreeName)

    LoadSheet()
    

    oTreeModel = oTree.getModel()

    SetRTCTree_listener = SetRTCTreeListener( oTreeModel, smgr, ctx, dlg_control )
    setrtctree_control = dlg_control.getControl(ControlName.CreateTreeBName)
    setrtctree_control.addActionListener(SetRTCTree_listener)

    tfns_control = dlg_control.getControl( ControlName.NameServerFName )
    tfns_control.setText('localhost')

    xo_control = dlg_control.getControl( ControlName.XoffsetBName )
    xo_control.setText(str(0))

    yo_control = dlg_control.getControl( ControlName.YoffsetBName )
    yo_control.setText(str(0))

    ro_control = dlg_control.getControl( ControlName.RoffsetBName )
    ro_control.setText(str(0))

    xs_control = dlg_control.getControl( ControlName.XscaleBName )
    xs_control.setText(str(100))

    ys_control = dlg_control.getControl( ControlName.YscaleBName )
    ys_control.setText(str(100))

    dtcb_control = dlg_control.getControl( ControlName.DataTypeCBName )
    dtcb_control.addItem ("", dtcb_control.ItemCount)
    for n in DrawDataPort.DataType.DataTypeList:
        dtcb_control.addItem (n, dtcb_control.ItemCount)
    
    ptcb_control = dlg_control.getControl( ControlName.PortTypeCBName )
    ptcb_control.addItem ("DataInPort", ptcb_control.ItemCount)
    ptcb_control.addItem ("DataOutPort", ptcb_control.ItemCount)
    ptcb_control.setText('DataInPort')

    setallpos_listener = SetAllPosListener( dlg_control )
    setallpos_control = dlg_control.getControl(ControlName.SetAllPosBName)
    setallpos_control.addActionListener(setallpos_listener)

    
    
    
    
    
    dlg_control.execute()
    dlg_control.dispose()