plugins/svgui/svgui.py
changeset 192 f0482f1ae901
parent 191 5b1fa0e06284
child 198 cf99e75b6dda
equal deleted inserted replaced
191:5b1fa0e06284 192:f0482f1ae901
   184         doc = SVGDocument(self.GetSVGFilePath())
   184         doc = SVGDocument(self.GetSVGFilePath())
   185         root_element = doc.GetRootElement()
   185         root_element = doc.GetRootElement()
   186         window_size = (int(float(root_element.GetAttribute("width"))),
   186         window_size = (int(float(root_element.GetAttribute("width"))),
   187                        int(float(root_element.GetAttribute("height"))))
   187                        int(float(root_element.GetAttribute("height"))))
   188 
   188 
   189 ##        svgfilepath = self.GetSVGFilePath()
   189         svgfilepath = self.GetSVGFilePath()
   190 ##        xmlfilepath = self.GetFilePath()
   190         xmlfilepath = self.GetFilePath()
   191 ##        shutil.copy(svgfilepath, buildpath)
   191         shutil.copy(svgfilepath, buildpath)
   192 ##        shutil.copy(xmlfilepath, buildpath)
   192         shutil.copy(xmlfilepath, buildpath)
   193         
   193         
   194         generator = _SVGUICGenerator(self.GetElementsByType(), self.GetSVGFilePath(), self.GetFilePath(), self.GetCurrentLocation())
   194         generator = _SVGUICGenerator(self.GetElementsByType(), 
       
   195                                      os.path.split(self.GetSVGFilePath())[1], 
       
   196                                      os.path.split(self.GetFilePath())[1], 
       
   197                                      self.GetCurrentLocation())
   195         generator.GenerateProgram(window_size, buildpath, progname)
   198         generator.GenerateProgram(window_size, buildpath, progname)
   196         Gen_C_file = os.path.join(buildpath, progname+".cpp" )
   199         Gen_C_file = os.path.join(buildpath, progname+".cpp" )
   197         
   200         
   198         if wx.Platform == '__WXMSW__':
   201         if wx.Platform == '__WXMSW__':
   199             cxx_flags = "-I..\\..\\wxPython-src-2.8.7.1\\bld\\lib\\wx\\include\\msw-unicode-release-2.8 -I..\\..\\wxPython-src-2.8.7.1\\include -I..\\..\\wxPython-src-2.8.7.1\\contrib\\include -I..\\..\\matiec\\lib -DWXUSINGDLL -D__WXMSW__ -mthreads"
   202             cxx_flags = "-I..\\..\\wxPython-src-2.8.7.1\\bld\\lib\\wx\\include\\msw-unicode-release-2.8 -I..\\..\\wxPython-src-2.8.7.1\\include -I..\\..\\wxPython-src-2.8.7.1\\contrib\\include -I..\\..\\matiec\\lib -DWXUSINGDLL -D__WXMSW__ -mthreads"
   483         return text
   486         return text
   484     
   487     
   485     def GenerateProgramInitFrame(self):
   488     def GenerateProgramInitFrame(self):
   486         text = """MainFrame::MainFrame(wxWindow *parent, const wxString& title, const wxPoint& pos,const wxSize& size, long style): wxFrame(parent, wxID_ANY, title, pos, size, style)
   489         text = """MainFrame::MainFrame(wxWindow *parent, const wxString& title, const wxPoint& pos,const wxSize& size, long style): wxFrame(parent, wxID_ANY, title, pos, size, style)
   487 {
   490 {
       
   491   wxFileName apppath(wxTheApp->argv[0]);
       
   492   wxFileName svgfilepath(apppath.GetPath(), wxT("%s"));
       
   493   wxFileName xmlfilepath(apppath.GetPath(), wxT("%s"));
       
   494 
   488   m_svgCtrl = new Program(this);
   495   m_svgCtrl = new Program(this);
   489   if (m_svgCtrl->LoadFiles(wxT("%s"), wxT("%s")))
   496   if (m_svgCtrl->LoadFiles(svgfilepath.GetFullPath(), xmlfilepath.GetFullPath()))
   490   {
   497   {
   491     Show(true);
   498     Show(true);
   492     m_svgCtrl->SetFocus();
   499     m_svgCtrl->SetFocus();
   493     m_svgCtrl->SetFitToFrame(true);
   500     m_svgCtrl->SetFitToFrame(true);
   494     m_svgCtrl->InitScrollBars();
   501     m_svgCtrl->InitScrollBars();
   706             element_type = GetElementType(element)
   713             element_type = GetElementType(element)
   707             texts = {"location" : current_location, "id" : element.getid()}
   714             texts = {"location" : current_location, "id" : element.getid()}
   708             
   715             
   709             text += """
   716             text += """
   710   element = (SVGUIElement*)GetElementById(wxT("%(id)d"));
   717   element = (SVGUIElement*)GetElementById(wxT("%(id)d"));
   711   beremiz__QX%(location)s_%(id)d_1 = _copy__QX%(location)s_%(id)d_1 = 1;
   718   beremiz__QX%(location)s_%(id)d_1 = _copy__QX%(location)s_%(id)d_1 = element->IsVisible();
   712   beremiz__QX%(location)s_%(id)d_2 = _copy__QX%(location)s_%(id)d_2 = 1;
   719   beremiz__QX%(location)s_%(id)d_2 = _copy__QX%(location)s_%(id)d_2 = element->IsEnabled();
   713 """%texts
   720 """%texts
   714             if element_type == ITEM_BUTTON:
   721             if element_type == ITEM_BUTTON:
       
   722                 text += "  beremiz__QX%(location)s_%(id)d_3 = _copy__QX%(location)s_%(id)d_3 = ((SVGUIButton*)element)->GetToggle();\n"%texts
   715                 text += "  beremiz__IX%(location)s_%(id)d_1 = _copy__IX%(location)s_%(id)d_1 = ((SVGUIButton*)element)->GetToggle();\n"%texts
   723                 text += "  beremiz__IX%(location)s_%(id)d_1 = _copy__IX%(location)s_%(id)d_1 = ((SVGUIButton*)element)->GetToggle();\n"%texts
   716             elif element_type == ITEM_TEXT:
   724             elif element_type == ITEM_TEXT:
       
   725                 text += "  beremiz__QB%(location)s_%(id)d_3 = _copy__QB%(location)s_%(id)d_3 = ((SVGUITextCtrl*)element)->GetValue();\n"%texts
   717                 text += "  beremiz__IB%(location)s_%(id)d_1 = _copy__IB%(location)s_%(id)d_1 = ((SVGUITextCtrl*)element)->GetValue();\n"%texts
   726                 text += "  beremiz__IB%(location)s_%(id)d_1 = _copy__IB%(location)s_%(id)d_1 = ((SVGUITextCtrl*)element)->GetValue();\n"%texts
   718             elif element_type == ITEM_SCROLLBAR:
   727             elif element_type == ITEM_SCROLLBAR:
       
   728                 text += "  beremiz__QW%(location)s_%(id)d_3 = _copy__QW%(location)s_%(id)d_3 = ((SVGUIScrollBar*)element)->GetThumbSize();\n"%texts
       
   729                 text += "  beremiz__QW%(location)s_%(id)d_4 = _copy__QW%(location)s_%(id)d_4 = ((SVGUIScrollBar*)element)->GetRange();\n"%texts
       
   730                 text += "  beremiz__QW%(location)s_%(id)d_5 = _copy__QW%(location)s_%(id)d_5 = ((SVGUIScrollBar*)element)->GetThumbPosition();\n"%texts
   719                 text += "  beremiz__IW%(location)s_%(id)d_1 = _copy__IW%(location)s_%(id)d_1 = ((SVGUIScrollBar*)element)->GetThumbPosition();\n"%texts
   731                 text += "  beremiz__IW%(location)s_%(id)d_1 = _copy__IW%(location)s_%(id)d_1 = ((SVGUIScrollBar*)element)->GetThumbPosition();\n"%texts
   720             elif element_type == ITEM_ROTATING:
   732             elif element_type == ITEM_ROTATING:
       
   733                 text += "  beremiz__QD%(location)s_%(id)d_3 = _copy__QD%(location)s_%(id)d_3 = ((SVGUIRotatingCtrl*)element)->GetAngle();\n"%texts
   721                 text += "  beremiz__ID%(location)s_%(id)d_1 = _copy__ID%(location)s_%(id)d_1 = ((SVGUIRotatingCtrl*)element)->GetAngle();\n"%texts
   734                 text += "  beremiz__ID%(location)s_%(id)d_1 = _copy__ID%(location)s_%(id)d_1 = ((SVGUIRotatingCtrl*)element)->GetAngle();\n"%texts
   722             elif element_type == ITEM_NOTEBOOK:
   735             elif element_type == ITEM_NOTEBOOK:
       
   736                 text += "  beremiz__QB%(location)s_%(id)d_3 = _copy__QB%(location)s_%(id)d_3 = ((SVGUINoteBook*)element)->GetCurrentPage();\n"%texts
   723                 text += "  beremiz__IB%(location)s_%(id)d_1 = _copy__IB%(location)s_%(id)d_1 = ((SVGUINoteBook*)element)->GetCurrentPage();\n"%texts
   737                 text += "  beremiz__IB%(location)s_%(id)d_1 = _copy__IB%(location)s_%(id)d_1 = ((SVGUINoteBook*)element)->GetCurrentPage();\n"%texts
   724             elif element_type == ITEM_TRANSFORM:
   738             elif element_type == ITEM_TRANSFORM:
   725                 text += "  beremiz__QD%(location)s_%(id)d_3 = _copy__QD%(location)s_%(id)d_3 = ((SVGUITransform*)element)->GetX();\n"%texts
   739                 text += "  beremiz__QD%(location)s_%(id)d_3 = _copy__QD%(location)s_%(id)d_3 = ((SVGUITransform*)element)->GetX();\n"%texts
   726                 text += "  beremiz__QD%(location)s_%(id)d_4 = _copy__QD%(location)s_%(id)d_4 = ((SVGUITransform*)element)->GetY();\n"%texts
   740                 text += "  beremiz__QD%(location)s_%(id)d_4 = _copy__QD%(location)s_%(id)d_4 = ((SVGUITransform*)element)->GetY();\n"%texts
   727                 text += "  beremiz__QD%(location)s_%(id)d_5 = _copy__QD%(location)s_%(id)d_5 = ((SVGUITransform*)element)->GetXScale();\n"%texts
   741                 text += "  beremiz__QD%(location)s_%(id)d_5 = _copy__QD%(location)s_%(id)d_5 = ((SVGUITransform*)element)->GetXScale();\n"%texts