Пример #1
0
    def showImportDialog(self, writer):
        dialog = self.forms.createDialog("Kexi Import")
        dialog.setButtons("Ok|Cancel")
        dialog.setFaceType("List") #Auto Plain List Tree Tabbed

        openpage = dialog.addPage("Open","Import from Kexi Project File","document-open")
        openwidget = self.forms.createFileWidget(openpage, "kfiledialog:///kcellskexidbimportopen")
        openwidget.setMode("Opening")
        openwidget.setFilter("*.kexi *.kexis *kexic|Kexi Project Files\n*|All Files")

        datapage = dialog.addPage("Import","Import to sheet beginning at cell","document-import")
        sheetslistview = KCells.createSheetsListView(datapage)
        sheetslistview.setEditorType("KCCell")

        if dialog.exec_loop():
            projectfile = openwidget.selectedFile()
            if not os.path.isfile(projectfile):
                raise "File '%s' not found." % projectfile

            currentSheet = sheetslistview.sheet()
            if not currentSheet:
                raise "No current sheet."
            if not writer.setSheet(currentSheet):
                raise "Invalid sheet \"%s\" defined." % currentSheet

            cell = sheetslistview.editor()
            if not writer.setCell(cell):
                raise "Invalid cell \"%s\" defined." % cell

            connection = self.createConnection(projectfile)
            return connection
        return None
Пример #2
0
    def __init__(self, scriptaction):
        self.scriptaction = scriptaction
        self.currentpath = self.scriptaction.currentPath()

        self.forms = Kross.module("forms")
        self.dialog = self.forms.createDialog("CSV Export")
        self.dialog.setButtons("Ok|Cancel")
        self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed

        savepage = self.dialog.addPage("Save","Export to CSV File","document-save")
        self.savewidget = self.forms.createFileWidget(savepage, "kfiledialog:///kcellscsvexportsave")
        self.savewidget.setMode("Saving")
        self.savewidget.setFilter("*.csv *.txt|Comma-Separated-KCValue Files\n*|All Files")

        datapage = self.dialog.addPage("Export","Export Sheets and ranges","document-export")
        self.sheetslistview = KCells.createSheetsListView(datapage)
        self.sheetslistview.setSelectionType("MultiSelect")
        self.sheetslistview.setEditorType("Range")

        optionspage = self.dialog.addPage("Options","Comma Separated KCValue Options","configure")
        self.optionswidget = self.forms.createWidgetFromUIFile(optionspage, os.path.join(self.currentpath, "csvoptions.ui"))

        if self.dialog.exec_loop():
            try:
                self.doExport()
            except:
                self.forms.showMessageBox("Error", "Error", "%s" % "".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) ))
Пример #3
0
    def __init__(self, action, config):
        self.action = action
        self.config = config

        forms = Kross.module("forms")
        dialog = forms.createDialog("Import vCard")
        # dialog.minimumWidth = 400
        # dialog.minimumHeight = 300
        dialog.setButtons("Ok|Cancel")
        dialog.setFaceType("List")  # Auto Plain List Tree Tabbed

        filepage = dialog.addPage("Open", "vCard File", "document-open")
        # deffile = "/home/kde4/vcardtest/addressbook.vcf" #"kfiledialog:///kcellsvcardimport"
        deffile = "kfiledialog:///kcellsvcardimport"
        self.openwidget = forms.createFileWidget(filepage, deffile)
        self.openwidget.setMode("Opening")
        self.openwidget.setFilter("*.vcf|vCard Files\n*|All Files")

        datapage = dialog.addPage("Import", "Import to sheet beginning at cell", "document-import")
        self.sheetslistview = KCells.createSheetsListView(datapage)
        self.sheetslistview.setEditorType("KCCell")

        if not dialog.exec_loop():
            return

        vcardfilename = self.openwidget.selectedFile()
        if not os.path.isfile(vcardfilename):
            raise "File '%s' not found." % vcardfilename

        currentSheet = self.sheetslistview.sheet()
        if not currentSheet:
            raise "No current sheet."

        self.importVCardFile(vcardfilename, currentSheet)
Пример #4
0
    def showExportDialog(self, reader):
        dialog = self.forms.createDialog("Kexi Export")
        dialog.setButtons("Ok|Cancel")
        dialog.setFaceType("List")  #Auto Plain List Tree Tabbed

        savepage = dialog.addPage("Save", "Export to Kexi Project File",
                                  "document-save")
        savewidget = self.forms.createFileWidget(
            savepage, "kfiledialog:///kcellskexidbexport")
        savewidget.setMode("Saving")
        savewidget.setFilter(
            "*.kexi *.kexis *kexic|Kexi Project Files\n*|All Files")

        datapage = dialog.addPage("Export", "Export sheets and ranges",
                                  "document-export")
        sheetslistview = KCells.createSheetsListView(datapage)
        sheetslistview.setSelectionType("MultiSelect")
        sheetslistview.setEditorType("Range")

        if dialog.exec_loop():
            projectfile = savewidget.selectedFile()
            if not os.path.isfile(projectfile):
                raise "File '%s' not found." % projectfile
            reader.setSheets(sheetslistview.sheets())
            connection = self.createConnection(projectfile)
            return connection
        return None
Пример #5
0
    def __init__(self, scriptaction):
        self.scriptaction = scriptaction
        self.currentpath = self.scriptaction.currentPath()

        self.forms = Kross.module("forms")
        self.dialog = self.forms.createDialog("CSV Import")
        self.dialog.setButtons("Ok|Cancel")
        self.dialog.setFaceType("List")  #Auto Plain List Tree Tabbed

        openpage = self.dialog.addPage("Open", "Import from CSV File",
                                       "document-open")
        self.openwidget = self.forms.createFileWidget(
            openpage, "kfiledialog:///kcellscsvimportopen")
        self.openwidget.setMode("Opening")
        self.openwidget.setFilter(
            "*.csv *.txt|Comma-Separated-KCValue Files\n*|All Files")

        datapage = self.dialog.addPage("Import",
                                       "Import to sheet beginning at cell",
                                       "document-import")
        self.sheetslistview = KCells.createSheetsListView(datapage)
        self.sheetslistview.setEditorType("KCCell")

        optionspage = self.dialog.addPage("Options",
                                          "Comma Separated KCValue Options",
                                          "configure")
        self.optionswidget = self.forms.createWidgetFromUIFile(
            optionspage, os.path.join(self.currentpath, "csvoptions.ui"))

        if self.dialog.exec_loop():
            try:
                self.doImport()
            except:
                self.forms.showMessageBox(
                    "Error", "Error", "%s" % "".join(
                        traceback.format_exception(sys.exc_info()[0],
                                                   sys.exc_info()[1],
                                                   sys.exc_info()[2])))
Пример #6
0
    def showExportDialog(self, reader):
        dialog = self.forms.createDialog("Kexi Export")
        dialog.setButtons("Ok|Cancel")
        dialog.setFaceType("List") #Auto Plain List Tree Tabbed

        savepage = dialog.addPage("Save","Export to Kexi Project File","document-save")
        savewidget = self.forms.createFileWidget(savepage, "kfiledialog:///kcellskexidbexport")
        savewidget.setMode("Saving")
        savewidget.setFilter("*.kexi *.kexis *kexic|Kexi Project Files\n*|All Files")

        datapage = dialog.addPage("Export","Export sheets and ranges","document-export")
        sheetslistview = KCells.createSheetsListView(datapage)
        sheetslistview.setSelectionType("MultiSelect")
        sheetslistview.setEditorType("Range")

        if dialog.exec_loop():
            projectfile = savewidget.selectedFile()
            if not os.path.isfile(projectfile):
                raise "File '%s' not found." % projectfile
            reader.setSheets( sheetslistview.sheets() )
            connection = self.createConnection(projectfile)
            return connection
        return None
Пример #7
0
    def __init__(self, action, config):
        self.action = action
        self.config = config

        forms = Kross.module("forms")
        dialog = forms.createDialog("Import vCard")
        #dialog.minimumWidth = 400
        #dialog.minimumHeight = 300
        dialog.setButtons("Ok|Cancel")
        dialog.setFaceType("List")  #Auto Plain List Tree Tabbed

        filepage = dialog.addPage("Open", "vCard File", "document-open")
        #deffile = "/home/kde4/vcardtest/addressbook.vcf" #"kfiledialog:///kcellsvcardimport"
        deffile = "kfiledialog:///kcellsvcardimport"
        self.openwidget = forms.createFileWidget(filepage, deffile)
        self.openwidget.setMode("Opening")
        self.openwidget.setFilter("*.vcf|vCard Files\n*|All Files")

        datapage = dialog.addPage("Import",
                                  "Import to sheet beginning at cell",
                                  "document-import")
        self.sheetslistview = KCells.createSheetsListView(datapage)
        self.sheetslistview.setEditorType("KCCell")

        if not dialog.exec_loop():
            return

        vcardfilename = self.openwidget.selectedFile()
        if not os.path.isfile(vcardfilename):
            raise "File '%s' not found." % vcardfilename

        currentSheet = self.sheetslistview.sheet()
        if not currentSheet:
            raise "No current sheet."

        self.importVCardFile(vcardfilename, currentSheet)