Esempio n. 1
0
    def __init__(self, padre, interfazdatos, porterodatos):
        from Driza.datos.conversion import AgenteConversion
        self.__portero = porterodatos
        QTabWidget.__init__(self, padre, "Grid")
        self.setTabPosition(QTabWidget.Bottom)
        self.tab = QWidget(self, "tab")
        tabLayout = QVBoxLayout(self.tab, 11, 6, "tabLayout")
        self.table1 = QTable(self.tab, "table1")
        tabLayout.addWidget(self.table1)
        self.insertTab(self.tab,  QString.fromLatin1("&Registros"))
        self.tab_2 = QWidget(self, "tab_2")
        tabLayout_2 = QVBoxLayout(self.tab_2, 11, 6, "tabLayout_2")
        self.table2 = QTable(self.tab_2, "table2")
        tabLayout_2.addWidget(self.table2)
        self.insertTab(self.tab_2, QString.fromLatin1("&Variables"))
        from Driza.iuqt3.vprincipal.dcasos import DCasos
        self.dcasos = DCasos(self.table1, interfazdatos)
        self.modoetiqueta = False # Variable que guarda si estamos en modo etiqueta o normal

        self.__nreg = 10 
        self.__nvar = 10
        self.__idu = interfazdatos
        self.__init_t_reg()
        self.__init_t_var()
        self.__conexiones()
        self.__agenteconversion = AgenteConversion(self.__idu)
Esempio n. 2
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()
Esempio n. 3
0
 def receive(self, proc, buf, length):
     l = unicode(QString.fromUtf8(buf, length)).split("\n")
     self.buf.append(l[0])
     if len(l) > 1:
         self.output("".join(self.buf))
         for i in l[1:-1]:
             self.output(i)
         self.buf = [l[-1]]
Esempio n. 4
0
    def comarError(self, exception):
        if "urlopen error" in exception.message or "Socket Error" in exception.message:
            KMessageBox.error(None, i18n("Network error. Please check your network connections and try again."), i18n("COMAR Error"))
        elif "Access denied" in exception.message:
            message = i18n("You are not authorized for this operation.")
            KMessageBox.sorry(None, message, i18n("Error"))
        else:
            KMessageBox.error(None, QString.fromUtf8(str(exception)), i18n("COMAR Error"))

        self.errHandler()
Esempio n. 5
0
    def exceptionHandler(self, exception=None):
        exception = exception or self.lastError
        if "urlopen error" in str(exception) or "Socket Error" in str(exception):
            KMessageBox.error(None, i18n("Network error. Please check your network connections and try again or check your repository addresses."), i18n("COMAR Error"))
        elif "Access denied" in str(exception):
            message = i18n("You are not authorized for this operation.")
            KMessageBox.sorry(None, message, i18n("Error"))
        elif "PYCURL ERROR" in str(exception):
            message = i18n("Please check your network connection or repository addresses.")
            KMessageBox.sorry(None, message, i18n("Error"))
        else:
            KMessageBox.error(None, QString.fromUtf8(str(exception)), i18n("COMAR Error"))

        self.errHandler()
Esempio n. 6
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()
Esempio n. 7
0
def setWallpaper(path):
    "Changes current wallpaper with the new one"
    # Copy file to wallpapers dir:
    wallpapersdir = os.path.expanduser("~/.kde/share/wallpapers")
    if not (os.path.isdir(wallpapersdir)):
        os.makedirs(wallpapersdir)
    newpath = os.path.join(wallpapersdir, os.path.basename(path))
    shutil.copyfile(path, newpath)
    # Create a dcop object:
    client = DCOPClient()
    if not client.attach():
        raise WallpaperError, "Wallpaper cannot be changed"
    # Set Wallpaper:
    background = DCOPObj("kdesktop", client, "KBackgroundIface")
    ok, wallpaper = background.setWallpaper(QString(unicode(newpath)), 6)     # 6: Scaled
    if not ok:
        raise WallpaperError, "Wallpaper cannot be changed"
Esempio n. 8
0
#
# uniqstring2.py - coercing Python strings into and from QStrings
#
from qt import QString

s = "A string that contains just ASCII characters"
u = u"\u0411\u0412 - a string with a few Cyrillic characters"

qs = QString(s)
qu = QString(u)

aQCString = qu.utf8()
aPythonString = str(aQCString)
aPythonUnicodeObject = unicode(aPythonString, "utf-8")

print qs
print aPythonUnicodeObject.encode("utf-8")
Esempio n. 9
0
#
# uniqstring3.py - coercing Python strings into and from QStrings
#
from qt import QString
import sys

sys.setappdefaultencoding("utf-8")

s = "A string that contains just ASCII characters"
u = u"\u0411\u0412 - a string with a few Cyrillic characters"

qs = QString(s)
qu = QString(u)

print qs
print qu
Esempio n. 10
0
def qstr(text):
    return QString(unicode(text))
Esempio n. 11
0
 def __init__(self, text, icon, ttip, whatsit):
     KGuiItem.__init__(self, QString(text), QString(icon), QString(ttip),
                       QString(whatsit))