示例#1
0
文件: MainApp.py 项目: python4d/imd
  def __init__(self,parent=None,debug=True):
    super(cMainFrame,self).__init__(parent)

    self.debug=debug
  # Gestion des paramêtres projet
    self.oProjetIMD=Projet.ProjetIMD(self)
  # Initialiser les différents Timer
    self.oTimer=Timer.cTimer(self)
  # Gestion des fonctions de l'IHM, module Notebook
    self.oNoteBook=NoteBook.NoteBook(self)
  # Gestion des fonctions de l'IHM, module Notebook
    self.oPlastProcess=PlastProcess.PlastProcess(self)    

  #Initialisation des éléments IHM
    self.m_statusBar.SetStatusWidths([250,-1])
    if (self.oNoteBook.RefreshOnListBox_vtk(self.oProjetIMD.projet["root"]["dir"]["plast3d"])==-1):
      print >>sys.stderr,"Erreur: Répertoire ""plast"" de base non présent sous le dossier IMD3D."
    else:
      self.oTimer.oRefreshListeofVTKTimer.Start(10000)
  #Init Visualisation 3D-vtk du cache des points et cell_data
    self.cache_liste_points={}
    self.m_choice_vtk_color.Clear()
    self.m_choice_vtk_color.Append("Z-Hauteur")
    self.m_choice_vtk_color.SetSelection(0)
  ##début du test pour chargé un STL et le transformer en BMP 2D####
#    a=pystl.cSTL("./stl/ship.stl")
#    a.read(scale=500,fileformat='b')
#    _size,_buffer=a.raw_bitmap()
#    image_bmp = Common.scale_bitmap(wx.BitmapFromBuffer(_size[0],_size[1],_buffer),500,500)
#    self.TopLevelParent.m_bitmap_test.SetBitmap(image_bmp)
  ##fin du test  
  #Init du directory PLAST3D-VTK (certaines propriétés IHM de la Class DirPicker ne sont pas settable via wxFormBuilder
    self.m_dirPicker_PLAST3D.SetPath(self.oProjetIMD.projet["root"]["dir"]["plast3d"])
    self.m_dirPicker_PLAST3D.GetPickerCtrl().SetLabel("Répertoire de l'éxécutable PLAST.EXE")
    #il est impossible de modifier le control text en READ_ONLY après sa création => self.m_dirPicker_PLAST3D.GetTextCtrl().SetDefaultStyle(wx.TE_READONLY)
    #On opte pour attacher l'événement KILL_FOCUS et SET_FOCUS afi de vérifier si le directory entré "à la main" est juste
    self.m_dirPicker_PLAST3D.GetTextCtrl().Bind( wx.EVT_KILL_FOCUS, self.OnKillFocus_DIR_PLAST3D )
    self.m_dirPicker_PLAST3D.GetTextCtrl().Bind( wx.EVT_SET_FOCUS, self.OnSetFocus_DIR_PLAST3D )
  #Message dans la console
    self.m_textCtrl_console.AppendText("(c) Dynamic3D/Python4D - 01/2013 - Version %s\n"%__version__)
    self.m_textCtrl_console.AppendText("OpenGL, version utilisée:%s\n" % self.oVueOpenGL.OpenGlVersion.split('-')[0])
    if self.debug==True:
      self.m_textCtrl_console.SetDefaultStyle(wx.TextAttr(wx.RED))
      self.m_textCtrl_console.AppendText("(!!!Attention vous êtes en MODE Debug les chargements des fichiers et animations ne sont pas optimisés !!!)\n")
      self.m_textCtrl_console.SetDefaultStyle(wx.TextAttr(wx.BLACK))
    self.m_textCtrl_console.AppendText("Bienvenue sur l'interface OpenGL/Python du projet IMD3D\n")
    if self.debug==True:
      sys.stdout = Common.RedirectOutput("out",self.m_textCtrl_console)
    sys.stderr = Common.RedirectOutput("err",self.m_textCtrl_console) 
    self.Maximize()
    self.Show() 
    wx.SplashScreen(wx.Bitmap("./images/splash.png"), wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT,2000, None, -1,style=wx.BORDER_NONE).Show()