Beispiel #1
0
 def __init__(self, parent):
     
     try:
         filePicker = QFileDialog()
         fileName = filePicker.getOpenFileName(parent, "Open File", "DSPToolProjects (*.dsp)")
         f = open (fileName[0], "r")
         parent.parent.project = pickle.load(f)
         f.close()
         filePicker.destroy()
         
                   
         parent.parent.fileMenu.saveProjectAction.setEnabled(True)
         parent.parent.signalMenu.addSignalAction.setEnabled(True)
         parent.parent.signalMenu.applyOperationAction.setEnabled(True)
         
         msg = QMessageBox(parent.parent)
         msg.setText("Project opened")
         msg.show()
         
         parent.parent.refreshTable()
      
         
     except:
         #tratar melhor
         msg = QErrorMessage(parent.parent)            
         msg.showMessage("Invalid File")
Beispiel #2
0
 def okClicked(self):
            
     if self.directory != "" and self.textBox.text() != "":
         try:
             if self.parent.parent.platform == "linux2":
                 os.mkdir(self.directory + "/"+ self.textBox.text())
                 self.parent.parent.project = Project(self.directory + "/"+ self.textBox.text(), self.textBox.text(), "linux2")
                                             
             elif self.parent.parent.platform == "win32":
                 os.mkdir(self.directory + "\\"+ self.textBox.text())
                 self.parent.parent.project = Project(self.directory + "\\"+ self.textBox.text(), self.textBox.text(), "win32")
                                                                                                 
             self.parent.parent.project.save()
             self.dialog.setVisible(False)
             
             self.parent.parent.fileMenu.saveProjectAction.setEnabled(True)
             self.parent.parent.signalMenu.addSignalAction.setEnabled(True)
             self.parent.parent.signalMenu.applyOperationAction.setEnabled(True)
             
             msg = QMessageBox(self.parent.parent)
             msg.setText("Project created")
             msg.show()
                               
                            
         except OSError:
             msg = QErrorMessage(self.parent.parent)            
             msg.showMessage("Project already exists")
Beispiel #3
0
 def getMsgBox(self, text, nRoom):
     msgBox = QMessageBox()
     msgBox.setWindowTitle("Room: " + str(nRoom))
     msgBox.setText(text)
     msgBox.addButton(QMessageBox.Ok)
     msgBox.show()
     msgBox.exec_()
Beispiel #4
0
 def saveProject(self):
     """
     """
     self.parent.project.save()
     
     msg = QMessageBox(self.parent)
     msg.setText("Project Saved")
     msg.show()
Beispiel #5
0
	def winsetup(self):
		msgbox = QMessageBox(self)
		msgbox.setWindowIcon(QIcon('img/note.png'))
		msgbox.resize(300, 80)
		msgbox.setWindowTitle('ADLMIDI pyGUI')
		text = "<center><b>ADLMIDI cannot be found!</b></center><br>" + "Please check that " + "<b>" + binary + "</b>" + " is in the same folder as this program."
		msgbox.setText(text)
		msgbox.show()
    def help(self):
        msg = '''
Don't Panic!
'''
        mb = QMessageBox(self)
        mb.setText(msg.strip())
        mb.setIcon(QtGui.QMessageBox.Information)
        mb.setWindowTitle('About')
        mb.show()
    def about(self):
        msg = '''
About this thing
'''
        mb = QMessageBox(self)
        mb.setText(msg.strip())
        mb.setIcon(QtGui.QMessageBox.Information)
        mb.setWindowTitle('About')
        mb.show()
Beispiel #8
0
    def _Proccessor(self):
        """开始生成所需要要生成的
        三角形内容"""
        import basic.XMLConfig
        from core import plotTriangle
        if len(str(self.lineEdit_Number.text()))<1:
            msg = QMessageBox()
            msg.setText(QApplication.translate("Cannot get N", "N未输入", None, QApplication.UnicodeUTF8))
            msg.setWindowTitle(QApplication.translate("Error", "错误", None, QApplication.UnicodeUTF8))
            msg.show()
            
        else:
            MaxLen =  int(str(self.lineEdit_Number.text()))
            print MaxLen
            #首先判断选择
            rootPath = basic.XMLConfig.getRootPath()
       
            if rootPath[len(rootPath)-1] != '\\':
                rootPath = rootPath + '\\'
            print rootPath
            tr = plotTriangle.CreateGTNTriangel()
            tr._set_root_path(rootPath)
            if self.checkBox_triangular.isChecked() == True:
                """要对外生成堆垒三角了"""           
                print "----堆垒三角处理开始-----"  
                if self.checkBox_VLayout.isChecked() == True:
                    #要生成垂直三角                
                     for x in xrange(1,MaxLen):
                        tr.oneRow_with_Sum_verticalV3(' ',True,x,self._createFileName('GTN_VLayout',MaxLen))

                if self.checkBox_HLayout.isChecked() == True:
                    #要生成水平三角
                    for x in xrange(1,MaxLen):
                        tr.oneRow_with_Sum(x,self._createFileName('GTN_HLayout',MaxLen))                 
                print "----堆垒三角处理结束-----"  
            if self.checkBox_triangularNumber.isChecked() == True:
                #这边是列出内容的
                #列出方法是,水平优先,垂直优先,
                print "----堆垒三角值处理开始-----"  
                if self.checkBox_pascal.isChecked()==True:
                    #pascal 一一水平投影
                    tr._PascalTriangle_List(MaxLen,self._createFileName('P',MaxLen))

                if self.checkBox_evenSeq.isChecked()==True:
                    tr._Projection_EvenSeq(MaxLen,self._createFileName('E',MaxLen))

                    #垂直投影
                if self.checkBox_LongSeq.isChecked()==True:
                    tr._MetaLongSeq(MaxLen,self._createFileName('L',MaxLen))
                if self.checkBox_sortSeq.isChecked()==True:
                    tr._MetaShortSeq(MaxLen,self._createFileName('S',MaxLen))
                print "----堆垒三角值处理结束-----"  
Beispiel #9
0
 def prompt_for_closing_apps(self, apps_string):
     ''' Function to prompt user for prompting user
     for closing the restricted apps. '''
     msg = QMessageBox()
     msg.setIcon(QMessageBox.Warning)
     msg.setInformativeText("Kindly Close The Application")
     msg.setWindowTitle("ERROR!!!")
     msg.setWindowFlags(self.windowFlags()
                        | Qt.WindowStaysOnTopHint)  #added by RSR
     #msg.setDetailedText("The details are as follows:")
     msg.setStandardButtons(QMessageBox.Ok)
     msg.setText("Looks like  application {} is Open".format(
         apps_string.upper()))
     msg.show()
     msg.exec_()
     return True
Beispiel #10
0
    def keyPressEvent(self, event):
        selectedMovie = self.currentItem()
        if not selectedMovie: return

        if event.key() == Qt.Key_Delete:
            movieObject = selectedMovie.movieObject

            msg = QMessageBox(self)
            msg.setIcon(QMessageBox.Warning)
            msg.setText("Do you Want to delete {}?".format(movieObject.name))
            msg.setWindowTitle("Delete Movie")
            msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
            msg.show()

            if msg.exec_() == QMessageBox.Ok:
                selectedMovie.movieObject.delete()

                self.takeItem(self.row(selectedMovie))
Beispiel #11
0
	def about(self):
		if self.about_window is None:
			window = QMessageBox(self)
			self.about_window = window
		else: window = self.about_window
		window = self.about_window
		window.setWindowIcon(QIcon(self.abouticon))
		window.setWindowTitle('About ADLMIDI pyGUI')
		
		credits = "<center><b>ADLMIDI pyGUI v%s (%s)</b><br>Developed by Tristy H. \"KittyTristy\"<br>[<a href=\"https://github.com/KittyTristy/ADLMIDI-pyGUI\">Website</a>] [<a href=\"mailto:[email protected]\">Email</a>] <br><br><br>" % (__version__, system())
		title = "<b>ADLMIDI pyGUI</b> is a GUI wrapper<br>written in Python for use with..<br><br><b>ADLMIDI: MIDI Player<br>for Linux and Windows with OPL3 emulation</b><br>"
		cw = "(C) -- <a href=\"http://iki.fi/bisqwit/source/adlmidi.html\">http://iki.fi/bisqwit/source/adlmidi.html</a></center>"
		credits = credits + title + cw
		window.setText(credits)
			
		window.show()
		window.activateWindow()
		window.raise_()
Beispiel #12
0
 def addSignalClicked(self):
             
     if self.fileName != "" and self.nameBox.text() != "":
         self.parent.parent.project.addSignal(self.nameBox.text(), self.fileName, self.commentaryBox.toPlainText(), self.sampleRate.text())
         self.dialog.setVisible(False)
         label = self.parent.parent.project.signalList[-1][0].getImage()
         
         if self.parent.parent.table.columnCount() == 0: self.parent.parent.table.setColumnCount(1)
         
         self.parent.parent.table.setRowCount(self.parent.parent.table.rowCount() + 1)
         
         self.parent.parent.table.setCellWidget(len(self.parent.parent.project.signalList)-1,0,label)
         self.parent.parent.table.resizeColumnsToContents()
         self.parent.parent.table.resizeRowsToContents()
         self.parent.parent.setLabels()
                         
         msg = QMessageBox(self.parent.parent)
         msg.setText("Signal added")
         msg.show()       
Beispiel #13
0
 def addSignalClicked():
     global directory
     
     if fileName != "" and nameBox.text() != "":
         parent.parent.project.addSignal(nameBox.text(), fileName, commentaryBox.toPlainText())
         dialog.setVisible(False)
         label = parent.parent.project.signalList[-1][0].getImage()
         
         if parent.parent.mainWidget.columnCount() == 0: parent.parent.mainWidget.setColumnCount(1)
         
         parent.parent.mainWidget.setRowCount(parent.parent.mainWidget.rowCount() + 1)
         
         parent.parent.mainWidget.setCellWidget(len(parent.parent.project.signalList)-1,0,label)
         parent.parent.mainWidget.resizeColumnsToContents()
         parent.parent.mainWidget.resizeRowsToContents()
                         
         msg = QMessageBox(parent.parent)
         msg.setText("Signal added")
         msg.show()
Beispiel #14
0
    def event_link_clicked(self, url):
        url_string = url.toString()

        if 'file' in urlparse.parse_qs(urlparse.urlparse(url_string).query):
            msgbox = QMessageBox()
            msgbox.setWindowTitle('Installing')
            msgbox.setText('Installing theme. Please wait...')
            msgbox.setStandardButtons(0)
            msgbox.setAttribute(Qt.WA_DeleteOnClose)
            msgbox.setWindowModality(Qt.NonModal)
            msgbox.show()
            msgbox.repaint(
            )  # Qt didn't want to show the text so we force a repaint

            # Download and install the theme
            package = self.module.download(
                'http://localhost/test/download.php?file=2800&name=Fat-flat.xpf'
            )
            #package = self.module.download(url_string)
            try:
                self.module.install(package)
                msgbox.close()

                complete_msgbox = QMessageBox()
                complete_msgbox.setWindowTitle('Complete')
                complete_msgbox.setText('Install complete.')
                complete_msgbox.setStandardButtons(QMessageBox.Ok)
                complete_msgbox.setAttribute(Qt.WA_DeleteOnClose)
                complete_msgbox.exec_()
            except:
                msgbox.close()
                print "Unexpected error:", sys.exc_info()[:2]

                failed_msgbox = QMessageBox()
                failed_msgbox.setWindowTitle('Failed')
                failed_msgbox.setText(
                    'Install failed. Please try again later.')
                failed_msgbox.setStandardButtons(QMessageBox.Ok)
                failed_msgbox.setAttribute(Qt.WA_DeleteOnClose)
                failed_msgbox.exec_()
        else:
            QDesktopServices.openUrl(url)
 def okClicked():
     global directory
     
     if directory != "" and textBox.text() != "":
         try:
             os.mkdir(directory + "/"+ textBox.text())
             parent.parent.project = Project(directory + "/"+ textBox.text(), textBox.text())
             parent.parent.project.save()
             dialog.setVisible(False)
             
             parent.parent.fileMenu.saveProjectAction.setEnabled(True)
             parent.parent.signalMenu.addSignalAction.setEnabled(True)
             parent.parent.signalMenu.applyOperationAction.setEnabled(True)
             
             msg = QMessageBox(parent.parent)
             msg.setText("Project created")
             msg.show()
                               
                            
         except OSError:
             msg = QErrorMessage(parent.parent)            
             msg.showMessage("Project already exists")
Beispiel #16
0
	def event_link_clicked(self, url):
		url_string = url.toString()

		if 'file' in urlparse.parse_qs(urlparse.urlparse(url_string).query):
			msgbox = QMessageBox()
			msgbox.setWindowTitle('Installing')
			msgbox.setText('Installing theme. Please wait...')
			msgbox.setStandardButtons(0)
			msgbox.setAttribute(Qt.WA_DeleteOnClose)
			msgbox.setWindowModality(Qt.NonModal)
			msgbox.show()
			msgbox.repaint() # Qt didn't want to show the text so we force a repaint

			# Download and install the theme
			package = self.module.download('http://localhost/test/download.php?file=2800&name=Fat-flat.xpf')
			#package = self.module.download(url_string)
			try:
				self.module.install(package)
				msgbox.close()

				complete_msgbox = QMessageBox()
				complete_msgbox.setWindowTitle('Complete')
				complete_msgbox.setText('Install complete.')
				complete_msgbox.setStandardButtons(QMessageBox.Ok)
				complete_msgbox.setAttribute(Qt.WA_DeleteOnClose)
				complete_msgbox.exec_()
			except:
				msgbox.close()
				print "Unexpected error:", sys.exc_info()[:2]

				failed_msgbox = QMessageBox()
				failed_msgbox.setWindowTitle('Failed')
				failed_msgbox.setText('Install failed. Please try again later.')
				failed_msgbox.setStandardButtons(QMessageBox.Ok)
				failed_msgbox.setAttribute(Qt.WA_DeleteOnClose)
				failed_msgbox.exec_()
		else:
			QDesktopServices.openUrl(url)