Exemple #1
0
 def readFiles(self,parent,path):
     for f in oslistdir(path):
         if ospathisdir(ospathjoin(path,f)):
             d = Dir(parent,f,path)
             self.readFiles(d,ospathjoin(path,f))    
         else:
             if not ospathjoin(f).startswith('.'):
                     File(parent,f,path)
Exemple #2
0
 def buildRun(self,prj):
     if self.isRunning == False:
         self.isRunning = True
     self.showOutput()
     self.parent.textEdit.clear()
     self.parent.textEdit.append("Ant Building and Installing... "+ospathjoin(prj.getPath(),"build.xml"))
     self.ant_thread.setCmd(self.cmd4+" "+ospathjoin(prj.getPath(),"build.xml"))
     self.parent.progressStart()
     self.ant_thread.run()
Exemple #3
0
 def paste(self,item):
     '''First check if item is file then get its parent 
         otherwise check if item is Dir'''
     if(item.isFile()):
         p = item.parent()
     else:
         p = item
     if(self.clipboard != []):
         for items in self.clipboard:
             if(items.isFile()):
                 itemspath = items.getPath()     
                 '''Check if we are pasting files that alreadt exists using ospathjoin'''
                 if not(ospathexists(ospathjoin(p.getPath(),items.name))): 
                     try:
                         shutil.copyfile(itemspath,ospathjoin(p.getPath(),items.name))
                         newItem = File(p,items.name,ospathdirname(itemspath))
                     except:
                         QMessageBox.about(self,"Error","File Cannot be Pasted"+ospathjoin(p.getPath(),items.name))
                 else:
                     QMessageBox.about(self,"Error","File already Exists "+ospathjoin(p.getPath(),items.name))
                     return
             elif(items.isDir()):
                 itemspath = items.getPath()     
                 '''Check if we are pasting files that alreadt exists using ospathjoin'''
                 if not(ospathexists(ospathjoin(p.getPath(),items.name))):
                     try:
                         shutil.copyfile(itemspath,ospathjoin(p.getPath(),items.name))
                         newItem = File(p,items.name,ospathdirname(itemspath))
                     except:
                         QMessageBox.about(self,"Error","File Cannot be Pasted"+ospathjoin(p.getPath(),items.name))
                 else:
                     QMessageBox.about(self,"Error","File already Exists "+ospathjoin(p.getPath(),items.name))
                     return
Exemple #4
0
 def init(self):
     self.setCaretLineBackgroundColor(self.colorStyle.caret)
     self.setMarginsBackgroundColor(self.colorStyle.margin)
     self.setMarkerBackgroundColor(self.colorStyle.marker,self.ARROW_MARKER_NUM)
     self.font = QFont()
     self.font.setFamily(fontName)
     #self.font.setFixedPitch(True)
     self.font.setPointSize(self.fontSize)
     self.setFont(self.font)
     self.fontmetrics = QFontMetrics(self.font)
     self.setMarginsFont(self.font)
     # Margin 0 is used for line numbers
     #self.setMarginLineNumbers(0, True)
     #self.setMarginWidth(0, self.fontmetrics.width("0000") + 6)
     self.setMarginLineNumbers(1, True)
     self.setMarginWidth(1, QString("-------"))
     self.setCaretLineVisible(True)
     if self.lang == 0:
         self.lexer = QsciLexerPython()
     elif self.lang == 1:
         self.lexer = QsciLexerCPP()
     elif self.lang == 2:
         self.lexer = LexerSquirrel(self.colorStyle,self)
     self.lexer.setDefaultFont(self.font)
     self.api = QsciAPIs(self.lexer)
     self.api.load(ospathjoin(apiDir,"emo.api"))
     self.api.prepare()
     self.lexer.setAPIs(self.api) #Very important do not change line otherwise gg
     self.setLexer(self.lexer) #Very important do not change line otherwise gg
Exemple #5
0
 def download(self):
     self.emit(SIGNAL("progress"))
     url = 'https://raw.github.com/Pyros2097/Sabel/master/build/exe.win32-2.7/library.zip'
     file_name = url.split('/')[-1]
     try:
         u = urllib2.urlopen(url)
         f = open(file_name+"_2097", 'wb')
         meta = u.info()
         file_size = int(meta.getheaders('Content-Length')[0])
         #print 'Downloading: %s Bytes: %s' % (file_name, file_size)
         file_size_dl = 0
         block_sz = 8192
         while self.running:
             buffer = u.read(block_sz)
             if not buffer:
                 break
             file_size_dl += len(buffer)
             f.write(buffer)
             status = file_size_dl * 100.0 / file_size
             self.emit(SIGNAL("status"),status)
         ''' The file library.zip is never used the library 
             is once loaded into the vm so no need to delete it '''
         f.close()
         if(self.running): #to prevent it from executing this code if terminated
             if(ospathexists(file_name)):
                 recycle(file_name) # deletes library.zip
             osrename(file_name+"_2097",ospathjoin(ospathdirname(file_name+"_2097"),"library.zip"))
             self.emit(SIGNAL("updated"))
             
     except urllib2.URLError as err:
         self.emit(SIGNAL("cant"))
     except:
         self.emit(SIGNAL("stop"))
     self.quit()
Exemple #6
0
 def setApi(self, text):
     self.api = QsciAPIs(self.lexer)
     self.api.load(ospathjoin(apiDir,text+".api"))
     self.api.prepare()
     self.lexer.setAPIs(self.api) #Very important do not change line otherwise gg
     self.setLexer(self.lexer) #Very important do not change line otherwise gg
     editStyle = config.readStyle()
     self.setMarginsBackgroundColor(QColor(editStyle["margin"]))
     '''This is done cause the margin color is set only when lexer is set 
Exemple #7
0
 def clean(self,prj):
     if self.isRunning == False:
         self.isRunning = True
     self.showOutput()
     self.parent.textEdit.clear()
     self.parent.textEdit.append("Ant Cleaning... "+prj.getPath())
     self.ant_thread.setCmd(self.cmd5+" "+ospathjoin(prj.getPath(),"build.xml"))
     self.parent.progressStart()
     self.parent.statusCleaning()
     self.ant_thread.run()
Exemple #8
0
 def __init__(self,parent,startDir,closed = False):
     QTreeWidgetItem.__init__(self,parent)
     self.path = ospathjoin(startDir)
     self.closed = closed
     if(self.closed):
         self.setIcon(0,Icons.cprj)
     else:
         self.setIcon(0,Icons.prj)
     self.setText (0, ospathbasename(ospathnormpath(startDir))) # set the text of the first 0
     self.setToolTip(0,startDir)
     self.Count += 1
     self.setExpanded(True)
Exemple #9
0
 def newFile(self,item):
     itempath = item.getPath()
     text,ok = QInputDialog.getText(self,"QInputDialog::getText()","Name:") 
     if (ok and text != ''):
         fname = ospathjoin(ospathdirname(itempath),str(text))
         try:
             nfile = open(fname,'w')
             nfile.close()
             f = File(item,ospathbasename(fname),ospathdirname(fname))
             item.addChild(f)
         except:
             QMessageBox.about(self,"Error","Could Not Create The File")
Exemple #10
0
 def __init__(self,parent,name,path):
     QTreeWidgetItem.__init__(self,parent)
     self.path = ospathjoin(path,name)
     self.setText (0, name)
     self.doc = False
     self.pic = False
     #mime = QMimeData()
     #mime.setUrls([QUrl.fromLocalFile(self.path)])
     #print self.path+":"+str(mime.hasUrls())
     self.Doc(name)
     self.Pic(name)
     if not (self.doc and self.pic):
         self.setIcon(0,Icons.file_obj)
Exemple #11
0
 def renameDir(self,item):
     itempath = item.getPath()
     text,ok = QInputDialog.getText(self,"QInputDialog::getText()","New Name:")
     if (ok and text != ''):
         newname = ospathjoin(ospathdirname(itempath),str(text))
         try:
             print newname
             osrename(itempath,newname)
             p = item.parent()
             p.removeChild(item)
             #self.refreshAllProjects()
         except:
             QMessageBox.about(self,"Error","Could Not Rename The File")
Exemple #12
0
 def renameProject(self,item):
     itempath = item.getPath()
     text,ok = QInputDialog.getText(self,"QInputDialog::getText()","New Name:")
     if (ok and text != ''):
         newname = ospathjoin(ospathdirname(itempath))
         try:
             print itempath
             print newname
             #osrename(itempath,newname)
             #self.takeTopLevelItem(self.indexOfTopLevelItem(item))
             #self.addProject(newname)
         except:
             QMessageBox.about(self,"Error","Could Not Rename The File")
Exemple #13
0
 def renameFile(self,item):
     text,ok = QInputDialog.getText(self,"QInputDialog::getText()","New Name:")
     itempath = item.getPath()
     if (ok and text != ''):
         newname = ospathjoin(ospathdirname(itempath),str(text))
         try:
             #print newname
             osrename(itempath,newname)
             p = item.parent()
             p.removeChild(item)
             f = File(p,ospathbasename(newname),ospathdirname(newname))
             #p.addChild(f)
         except:
             QMessageBox.about(self,"Error","Could Not Rename The File")
Exemple #14
0
 def readMainFiles(self,parent,path):
     for f in oslistdir(path):
         if not ospathisdir(ospathjoin(path,f)):
             if not ospathjoin(f).startswith('.'):
                     File(parent,f,path)
Exemple #15
0
 def readMainDir(self,parent,path):
     for d in oslistdir(path):
         if  ospathisdir(ospathjoin(path,d)):
             if not ospathjoin(d).startswith('.'):
                 i = Dir(parent,d,path)
                 self.readMainFiles(i,ospathjoin(path,d))
Exemple #16
0
 def __init__(self,parent,name,path):
     QTreeWidgetItem.__init__(self,parent)
     self.path = ospathjoin(path,name)
     self.name = name
     self.setText (0, name)
     self.setIcon(0,Icons.foldej)
Exemple #17
0
 def init(self):
     #Margin
     #print self.marginType(self.SymbolMargin)
     # Clickable margin 1 for showing markers
     self.setMarginSensitivity(0, True)
     #self.setMarginsBackgroundColor(self.colorStyle.margin)
     #self.connect(self,SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),self.on_margin_clicked)
     self.cursorPositionChanged.connect(self.parent.updateLine)
     # Margin 0 is used for line numbers
     #self.setMarginLineNumbers(0, True)
     #self.setMarginWidth(0, self.fontmetrics.width("0000") + 6)
     self.setMargin(config.margin())
     #self.linesChanged.connect(self.changeMarginWidht())           
     #Caret
     self.setCaretLineBackgroundColor(self.colorStyle.caret)
     self.setCaretLineVisible(True)
     
     #Indicator
     #self.setIndicatorForegroundColor(self.colorStyle.color)
     #self.setIndicatorOutlineColor(self.colorStyle.paper)
     
     #Marker
     self.markerDefine(QsciScintilla.RightArrow,self.ARROW_MARKER_NUM)
     self.markerDefine(Auto.auto_error,0)
     self.setMarkerBackgroundColor(self.colorStyle.marker,self.ARROW_MARKER_NUM)
     self.font = QFont(config.fontName(),config.fontSize())
     #self.font.setFixedPitch(True)
     self.setFont(self.font)
     self.fontmetrics = QFontMetrics(self.font)
     self.setMarginsFont(self.font)
     
     #Code-Complete
     self.registerImage(0,Auto.auto_class2)
     self.registerImage(1,Auto.auto_method)
     self.registerImage(2,Auto.auto_field)
     self.registerImage(3,Auto.auto_package)
     self.setAutoCompletionThreshold(config.thresh())
     self.setAutoCompletionSource(QsciScintilla.AcsAPIs)
     self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
     self.setBackspaceUnindents(True)
     self.setAutoCompletionCaseSensitivity(True)
     self.setIndentationsUseTabs(True)
     self.setTabIndents(True)
     self.setAutoIndent(True)
     self.setIndent(config.indent())
     #self.copyAvailable.connect(self.highlightWord)
     #self.indicatorClicked.connect(self.indicate)
     self.setIndicatorOutlineColor(QColor("#FFFFFF"))
     self.indicatorDefine(self.INDIC_BOX)
     self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
     #self.setAutoCompletionSource(QsciScintilla.AcsAll)
     #self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
     #self.setIndentation(5,25)
     #self.setSelectionBackgroundColor()
     #self.setSelectionForegroundColor()
     #self.SendScintilla(QsciScintilla.SCI_MARKERSETBACK,11,QColor(220,220,220))
     self.setLanguage()
     self.lexer.setDefaultFont(self.font)
     self.api = QsciAPIs(self.lexer)
     self.api.load(ospathjoin(apiDir,"emo.api"))
     self.api.prepare()
     self.lexer.setAPIs(self.api) #Very important do not change line otherwise gg
     self.setLexer(self.lexer) #Very important do not change line otherwise gg