Пример #1
0
    def slotAcceptData(self):
        tabForm=self.tabs[0][0]
        rec = self.tabs[0][1]
        for field, fieldDef in tabForm.fieldList:
            if fieldDef.readonly:
                continue
            elif fieldDef.relation <> None: #combobox
                if field == "usernr":
                    rec.updateUser()
                else:
                    rec.setFieldValue(rec.getDescriptorColumnName(field),
                                      tabForm.getFieldText(field))
                    fieldDef.default = tabForm.getFieldValue(field)
                    rec.setFieldValue(field, tabForm.getFieldValue(field))
            else:
                rec.setFieldValue(field, tabForm.getFieldValue(field))
            #print "Type ", type(getattr(rec, field))
        if self.mode == constants.INSERT:
            try:
                rec.insert()
                self.mode = constants.UPDATE
            except dbexceptions.dbError, dberr:
                QMessageBox.information(self, "Kura Error while inserting"
                                        , dberr.errorMessage)
                return False
            self.emit(PYSIGNAL("sigAcceptNewData"), (rec,))

            self.mode = constants.UPDATE
 def setSource(self, url):
     #action, key, filename = split_url(url)
     action, name = split_url(url)
     filehandler = self.app.game_fileshandler
     if action == 'cleanup':
         filehandler.cleanup_game(name)
     elif action == 'prepare':
         filehandler.prepare_game(name)
     elif action == 'edit':
         dlg = EditGameDataDialog(self, name)
         dlg.show()
     elif action == 'set_title_screenshot':
         self.select_title_screenshot(name)
     elif action == 'open_weblink':
         # get gamedata from doc object
         # to keep from excessive xml parsing
         gamedata = self.doc.gamedata
         cmd = self.app.myconfig.get('externalactions', 'launch_weblink')
         # for these url's, the name is the site
         weblink_url = gamedata['weblinks'][name]
         if '%s' in cmd:
             os.system(cmd % weblink_url)
         else:
             os.system("%s '%s'" % (cmd, weblink_url))
         # now we reset the name variable to reset the page properly
         name = gamedata['name']
     else:
         QMessageBox.information(self, '%s is unimplemented.' % action)
     # refresh the page
     self.set_game_info(name)
     # need to emit signal here for mainwin to pick up
     # this method is ugly
     if action in ['cleanup', 'prepare', 'edit']:
         mainwin = self.parent().parent()
         mainwin.refreshListView()
Пример #3
0
 def httpDone(self, error):
     qs = QString(self.http.readAll())
     match = self.imgre.search(unicode(qs))
     if error:
         QMessageBox.warning(self, "Warning",
                             "Cannot upload! Error:" + self.http.error())
     else:
         if match:
             self.image = match.group(1)
             if self.thumbfile:  # do second upload
                 if self.chkShack.isChecked():
                     self.BeginImageUpload(self.thumbfile,
                                           self.ImageShackPostData,
                                           self.http2)
                 elif self.chkArk.isChecked():
                     self.BeginImageUpload(self.thumbfile,
                                           self.ImageArkPostData,
                                           self.http2)
             else:  # no need to upload second
                 QMessageBox.information(self, "Info",
                                         "Image successfully uploaded!")
                 self.editUrl.setText(self.image)
         else:
             if self.thumbfile:
                 os.unlink(thumbfile)
             QMessageBox.warning(self, "Warning",
                                 "Cannot upload the image file!")
     self.http.closeConnection()
Пример #4
0
    def removeChildDataTypesSlot(self):
        """ Removes the selected data type from the list of parent data types. """

        if self._relationTypeView.mySelectedChildDataTypeList == []:
            QMessageBox.information(self._parentFrame, self._parentFrame.tr("DataFinder: No Selection"),
                                          "Please select a Data Type to remove!",
                                          self._parentFrame.tr("OK"), "", "",
                                          0, -1)
        else:
            self._relationTypeModel.removeChildDataTypes(self._relationTypeView.mySelectedChildDataTypeList)
            self._relationTypeView.setButtonsState(True)
Пример #5
0
    def addChildDataTypesSlot(self):
        """ Adds the selected data types from the list of available data types to the list of child data types. """

        if self._relationTypeView.mySelectedAvailableDataTypeList == []:
            QMessageBox.information(self._parentFrame, self._parentFrame.tr("DataFinder: No Selection"),
                                          "Please select a Data Type to add!",
                                          self._parentFrame.tr("OK"), "", "",
                                          0, -1)
        else:
            self._relationTypeModel.addChildDataTypes(self._relationTypeView.mySelectedAvailableDataTypeList)
            self._relationTypeView.setButtonsState(True)
 def http2Done(self, error):
     qs = QString(self.http2.readAll())
     match = self.imgre.search(unicode(qs))
     if error:
         QMessageBox.warning(self, "Warning", "Cannot upload! Error:" + self.http2.error())
     else:
         if match:
             self.editUrl.setText(self.image)
             self.editThumb.setText(match.group(1))
             QMessageBox.information(self, "Info", "Image successfully uploaded!")
         else:
             QMessageBox.warning(self, "Warning", "Cannot upload the thumbnail image file!")
     self.http2.closeConnection()
Пример #7
0
    def removeAttributeSlot(self):
        """ Removes selected rows/attributes. """

        if self._dataTypeView.propertyTable.currentSelection() == -1:
            QMessageBox.information(self._parentFrame, self._parentFrame.tr("DataFinder: No Selection"),
                                          "Please select a row to remove!",
                                          self._parentFrame.tr("OK"), "", "",
                                          0, -1)
        else:
            for index in self._dataTypeView.mySelectedRowList:
                self._dataTypeView.propertyTable.removeRow(index)
            self._dataTypeModel.myPropertyList = self._dataTypeView.myPropertyList
            self._dataTypeView.setButtonsState(True)
Пример #8
0
    def removeAttributeSlot(self):
        """ Removes selected rows/attributes. """

        if self._dataTypeView.propertyTable.currentSelection() == -1:
            QMessageBox.information(
                self._parentFrame,
                self._parentFrame.tr("DataFinder: No Selection"),
                "Please select a row to remove!", self._parentFrame.tr("OK"),
                "", "", 0, -1)
        else:
            for index in self._dataTypeView.mySelectedRowList:
                self._dataTypeView.propertyTable.removeRow(index)
            self._dataTypeModel.myPropertyList = self._dataTypeView.myPropertyList
            self._dataTypeView.setButtonsState(True)
 def select_title_screenshot(self, name):
     if self.select_title_screenshot_dlg is None:
         file_filter = "*.png|PNG Images\n*|All Files"
         path = self.app.dosbox.get_capture_path(name)
         dlg = QFileDialog(path, file_filter, self, 'select_title_screenshot_dlg', True)
         dlg.connect(dlg, SIGNAL('okClicked()'), self.title_screenshot_selected)
         dlg.connect(dlg, SIGNAL('cancelClicked()'), self.destroy_select_title_screenshot_dlg)
         dlg.connect(dlg, SIGNAL('closeClicked()'), self.destroy_select_title_screenshot_dlg)
         dlg.game_name = name
         dlg.show()
         self.select_title_screenshot_dlg = dlg
     else:
         # we shouldn't need this with a modal dialog
         QMessageBox.information(self, opendlg_errormsg)
Пример #10
0
    def _set_name(self, newname):
        name = self.name
        if newname == name:
            return
        if not re.match('^[a-zA-Z]\w*$', newname):
            QMessageBox.information(None, "grafit", 
                        "<b>Illegal column name</b><p>Column names must start with a letter and consist "
                        "of letters, numbers and underscore (_)<p>")
            return
        if newname in self.worksheet.column_names and name != newname:
            QMessageBox.information(None, "grafit", 
                        "<b>A column with this name already exists</b><p>Please choose another name<p>")
            return

        self.rename___(self.worksheet.name, self.name, newname).do().register()
Пример #11
0
 def scenarioSelection_currentRowChanged(self, current, previous):
     if not current.isValid():
         return
     currentItem = current.internalPointer()
     previousItem = previous.internalPointer()
     if not isinstance(currentItem, FileItem):
         return
     if currentItem == previousItem:
         return
     if currentItem.object.type() != ContainerType.Scenario:
         return
     if currentItem.object == self.currentScenario:
         return
     if self.currentIsChanged():
         ret = QMessageBox.information(self,
                 self.tr("Text Changed"),
                 self.tr("Do you want to save it?"),
                 QMessageBox.Save | QMessageBox.Cancel | QMessageBox.Discard)
         if ret == QMessageBox.Cancel:
             self.scenarioRestore.emit(previous)
             return
         elif ret == QMessageBox.Save:
             self.currentScenario.setText(qt.toUnicode(self.ui.textEditScenario.toPlainText()))
     self.setCurrentScenario(currentItem.object)
     self.ui.textEditScenario.setScenario(self.currentScenario)
     filepath = self.currentScenario.filePath()
     self.setWindowTitle(self.tr("%1 - Hestia [*]").arg(filepath))
Пример #12
0
 def http2Done(self, error):
     qs = QString(self.http2.readAll())
     match = self.imgre.search(unicode(qs))
     if error:
         QMessageBox.warning(self, "Warning",
                             "Cannot upload! Error:" + self.http2.error())
     else:
         if match:
             self.editUrl.setText(self.image)
             self.editThumb.setText(match.group(1))
             QMessageBox.information(self, "Info",
                                     "Image successfully uploaded!")
         else:
             QMessageBox.warning(self, "Warning",
                                 "Cannot upload the thumbnail image file!")
     self.http2.closeConnection()
Пример #13
0
 def __guardar_como(self):
     """Abre un diálogo pidiendo el nombre de archivo y guarda en dicho archivo"""
     filtro = ""
     for fmt in SL.extensiones_fichero:
         filtro = filtro+ "%s files (*.%s);;" % (fmt, fmt.lower())
     filename = QFileDialog.getSaveFileName(QString.null, filtro, self)
     filename = str(filename)
     if filename:
         from Driza.excepciones import FicheroExisteException, FicheroTipoDesconocidoException
         import re
         extension = re.compile('.*\..*')
         if not extension.match(filename):
             filename += ".driza"
         try:
             self.__gestorproyectos.guardar(filename)
         except FicheroExisteException, fichero:
             returncode = QMessageBox.information(self, 'Atencion:', 'El fichero' + fichero.fichero + ' ya existe' , 'Sobreescribir', 'Otro nombre', 'Cancelar', 0, 1)
             if returncode == 0:
                 self.__gestorproyectos.guardar(filename, True)
                 self.__idu.establecer_original()
                 self.__myUpdate()
             elif returncode == 1:
                 self.__guardarcomo()
         except FicheroTipoDesconocidoException:
             QMessageBox.warning(self, u'Atención', u'La extensión del fichero es incorrecta.\nPruebe con otra extensión')
             self.__gestorproyectos.fichero = None
Пример #14
0
 def slotLaunchDosbox(self, game=None):
     if game is None:
         game = self.listView.currentItem().game
     if self.app.game_fileshandler.get_game_status(game):
         self.app.dosbox.run_game(game)
     else:
         title = self.game_titles[game]
         box = QMessageBox.information(self, 'UnavailableGame')
         box.setText('%s is unavailable' % title)
Пример #15
0
 def __dproyecto_modificado(self):
     """Pregunta en caso de que haya sido modificado el proyecto si desea ser guardado"""
     if not self.__idu.original():
         returncode = QMessageBox.information(self, 'Atencion:', 'El proyecto actual ha sido modificado, desea guardarlo?', 'Guardarlo', 'No guardarlo', 'Volver', 0, 1)
         if returncode == 0:
             self.__guardar()
         elif returncode == 2:
             return False
     return True
Пример #16
0
    def slotPublish(self):
        global password
        text = self.w.entryText.text()

        firstline = text.left(text.find("\n"))
        if not firstline:
            QMessageBox.critical(self, "HATA", u"Bir metin girmediniz!")
            return

        # eğer EditMode içerisindeysek dosya adı liste kutusundan alınıyor
        # yeni bir dosya adı oluşturmaya gerek yok!
        if not self.inEdit:
            # dosya adını oluştur.
            self._genFilename(firstline)

        # her \n bir <br>\n ile değiştirilsin.
        text.replace("\n", "<br>\n")

        ret = QMessageBox.question(
            self, "Dikkat!", u"İçeriği gerçekten yayınlamak istiyor musun?",
            u"Evet", u"Hayır")
        if ret != 0:
            return

        # girdiyi gönder.
        ret = self.server.addEntry(username, password, str(self.filename),
                                   str(text.utf8()), self.inEdit)

        if not ret:
            QMessageBox.critical(self, "HATA", u"Girdi yayınlanamadı!")
        else:
            QMessageBox.information(self, "Bitti",
                                    u"Girdi başarı ile yayınlandı!")
            self._fillEntryList()

        # yayınladıktan sonra eğer içindeysek, EditMode'dan
        # çıkalım. Ve metin girişini temizleyelim.
        if self.inEdit:
            self.setEditMode(False)

        self.w.entryText.clear()
Пример #17
0
    def slotDeleteEntry(self):
        item = self.w.entryList.selectedItem()
        if not item:
            QMessageBox.critical(
                self, "HATA",
                u"Eski girdilerden hiçbiri seçili durumda değil!")
            return

        warnmsg = u"\"" + str(item.text().utf8(
        )) + u"\" isimli iletiyi gerçekten silmek istiyor musunuz?"
        ret = QMessageBox.question(self, "Dikkat!", warnmsg, u"Evet", u"Hayır")
        if ret != 0:
            return

        ret = self.server.deleteEntry(username, password, item.text().ascii())
        if not ret:
            QMessageBox.critical(self, "HATA", u"Girdi silme başarısız!")
        else:
            QMessageBox.information(self, "Bitti",
                                    u"Girdi başarı ile silindi!")
            self._fillEntryList()
 def httpDone(self, error):
     qs = QString(self.http.readAll())
     match = self.imgre.search(unicode(qs))
     if error:
         QMessageBox.warning(self, "Warning", "Cannot upload! Error:" + self.http.error())
     else:
         if match:
             self.image = match.group(1)
             if self.thumbfile:  # do second upload
                 if self.chkShack.isChecked():
                     self.BeginImageUpload(self.thumbfile, self.ImageShackPostData, self.http2)
                 elif self.chkArk.isChecked():
                     self.BeginImageUpload(self.thumbfile, self.ImageArkPostData, self.http2)
             else:  # no need to upload second
                 QMessageBox.information(self, "Info", "Image successfully uploaded!")
                 self.editUrl.setText(self.image)
         else:
             if self.thumbfile:
                 os.unlink(thumbfile)
             QMessageBox.warning(self, "Warning", "Cannot upload the image file!")
     self.http.closeConnection()
Пример #19
0
 def loop(self):
     """ 
     Procedimiento Bucle principal. 
     Lanza la ventana splash despues de la principal para que obtenga el foco
     Despues espera nuevos eventos por parte del usuario
     """
     self.vprincipal.show()
     if self.__options.vsplash == None: 
         if (self.__gestorconfig.configuracion["vsplash"] and not self.__gestorproyectos.fichero):
             self.__dsplash.show()
     elif self.__options.vsplash:
         self.__dsplash.show()
     if self.__nuevo:
         #Es la primera vez que se ejecuta el programa
         QMessageBox.information(self.vprincipal, 'Bienvenido', 'Parece que es la primera vez que ejecutas Driza')
     if self.__ioperaciones.listamodulosdefectuosos:
         ristra = u""
         for modulo in self.__ioperaciones.listamodulosdefectuosos:
             ristra += unicode(modulo) + "\n"
         mensaje = u"Las siguientes operaciones no han podido ser cargadas:\n" + ristra
         QMessageBox.information(self.vprincipal, "Error en la carga de operaciones", mensaje)
     logging.info('Lanzando Bucle Principal')
     self.exec_loop() 
     return
Пример #20
0
def launch_browser(browser, url, caption=None, message=None):
    if not caption: caption = "Info"
    if not message: message = "Launch web browser?"
    
    if not browser or not access(browser, X_OK):
        QMessageBox.warning(None, "Warning", "You must properly configure your web browser path in Preferences (within the Edit menu).")
        return 0


    cancel = QMessageBox.information(None, caption, message, "&Ok", "&Cancel")
    if cancel: return 0

    if sys.platform == 'win32':
        return spawnv(P_NOWAIT, browser, (" ", url))
    else:
        return spawnv(P_NOWAIT, browser, (browser, url))
Пример #21
0
def launch_browser(browser, url, caption=None, message=None):
    if not caption: caption = "Info"
    if not message: message = "Launch web browser?"

    if not browser or not access(browser, X_OK):
        QMessageBox.warning(
            None, "Warning",
            "You must properly configure your web browser path in Preferences (within the Edit menu)."
        )
        return 0

    cancel = QMessageBox.information(None, caption, message, "&Ok", "&Cancel")
    if cancel: return 0

    if sys.platform == 'win32':
        return spawnv(P_NOWAIT, browser, (" ", url))
    else:
        return spawnv(P_NOWAIT, browser, (browser, url))
Пример #22
0
 def accept(self):
     """Funcion redefinida que establece que debe hacer el dialogo cuando el usuario pulsa aceptar.
     Ante un cambio en los campos del dialogo, pregunta al usuario si guarda la configuración
     """
     if not self.__cambiado:
         DialogoConfig.accept(self)
     else:
         self.__cambiado = False # Volvemos a ponerlo en falso
         codigoretorno = QMessageBox.information(self, u'Atención: Guardar', \
                 u'Ha cambiado la configuración, desea guardarla?', \
                 'Guardarla', 'Cancelar', 'Dejarlo estar', 0, 1)
         if codigoretorno == 0:
             #Crear una interfaz usuario configuracion #DECISION DE DISEÑO, pendiente
             self.__guardar_config()
             DialogoConfig.accept(self)
         elif codigoretorno == 2:
             DialogoConfig.reject(self)
         else:
             self.__cambiado = True
Пример #23
0
 def __dguardarfichero(self):
     """Pregunta al usuario en que fichero guardar"""
     filterlist = ""
     for fmt in ["dro"]: #Candidata al fichero de listas
         filterlist = filterlist + "%s files (*.%s);;" % (fmt, fmt.lower())
     nombrefichero = QFileDialog.getSaveFileName(QString.null, filterlist, self)
     filename = str(nombrefichero)
     if filename:
         from Driza.excepciones import FicheroExisteException, \
                 FicheroTipoDesconocidoException
         try:
             self.__gestorsalida.guardar(self.__contenido, filename)
         except FicheroExisteException,fichero:
             codigoretorno = QMessageBox.information(self, 'Atencion:', 'El fichero' +\
                     fichero.fichero + ' ya existe' , 'Sobreescribir', \
                     'Otro nombre', 'Cancelar', 0, 1)
             if codigoretorno == 0:
                 self.__gestorsalida.guardar(self.__contenido, filename, True)
             elif codigoretorno == 1:
                 self.__dguardarfichero()
         except FicheroTipoDesconocidoException:
             QMessageBox.warning(self, u'Atención', \
                     u'La extensión del fichero es incorrecta.\nPruebe con otra extensión')
Пример #24
0
def MessageBox():
    Sleep(1)
    print('Creating message box')
    QMessageBox.information(None, 'My caption', 'This is a test')
    print('Message box done')
Пример #25
0
 def slotHelp(self):
     QMessageBox.information(self, "About " + 
                             self.firstTabTitle.replace("&",""), self.hint)
Пример #26
0
 def message(self, header, text):
     QMessageBox.information(None, header, text)
Пример #27
0
def MessageBox():
    Sleep(1)
    print('Creating message box')
    QMessageBox.information(None, 'My caption', 'This is a test')
    print('Message box done')
Пример #28
0
    def __showInformation(self, information):
        """ Shows the given information. """

        QMessageBox.information(self, self.__informationMessageCaption, information, QMessageBox.Ok)
Пример #29
0
    def __showInformation(self, information):
        """ Shows the given information. """

        QMessageBox.information(self, self.__informationMessageCaption,
                                information, QMessageBox.Ok)