Exemplo n.º 1
0
 def btnModifyIssues_click(self, *args):
     selectionModel = self.tblIssues.getSelectionModel()
     if selectionModel.isSelectionEmpty():
         return
     report = self.report
     store = report.getStore()
     ft = store.getDefaultFeatureType().getCopy()
     for attr in ft:
         isHidden = not attr.getTags().getBoolean("editable", False)
         attr.setHidden(isHidden)
         #print "%s.isHidden() %s" % (attr.getName(), isHidden)
     f = store.createNewFeature(ft, False)
     dynformManager = DynFormLocator.getDynFormManager()
     x = f.getAsDynObject()
     form = dynformManager.createJDynForm(ft)
     winManager = ToolsSwingLocator.getWindowManager()
     form.asJComponent().setPreferredSize(Dimension(400, 200))
     dialog = winManager.createDialog(form.asJComponent(),
                                      "Modificar incidencias", None,
                                      winManager.BUTTONS_OK_CANCEL)
     dialog.show(winManager.MODE.DIALOG)
     if dialog.getAction() == winManager.BUTTON_OK:
         form.getValues(x)
         for row in xrange(selectionModel.getMinSelectionIndex(),
                           selectionModel.getMaxSelectionIndex() + 1):
             if selectionModel.isSelectedIndex(row):
                 row = self.tblIssues.convertRowIndexToModel(row)
                 issue = report.getIssue(row).getEditable()
                 for attr in ft:
                     if not attr.isHidden():
                         issue.set(attr.getName(), f.get(attr.getName()))
                 report.putIssue(row, issue)
         report.refresh()
Exemplo n.º 2
0
 def btnCRS_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     title = i18n.getTranslation("_Select_the_reference_system")
     csSelect = CRSSelectPanelFactory.getUIFactory().getSelectCrsPanel(
         self.crs, True)
     ToolsSwingLocator.getWindowManager().showWindow(
         csSelect, title, WindowManager.MODE.DIALOG)
     if csSelect.isOkPressed():
         self.transform = None
         self.crs = csSelect.getProjection()
         self.txtCRS.setText(self.crs.getAbrev())
         if self.mapControl != None:
             if self.mapControl.getProjection() == self.crs:
                 self.transform = None
             else:
                 self.transform = self.mapControl.getProjection().getCT(
                     self.crs)
         self.updatePointInForm()
Exemplo n.º 3
0
 def btnHelp_click(self, *args):
     #controller = SwingController()
     #controller.setIsEmbeddedComponent(True)
     #controller.openDocument(File(getResource(__file__, "doc", "mobileforms.pdf")).toURI().toURL())
     #panel = SwingViewBuilder(controller).buildViewerPanel()
     panel = WebBrowserFactory.createWebBrowserPanel()
     panel.setPage(
         File(getResource(__file__, "doc",
                          "mobileforms.html")).toURI().toURL())
     windowManager = ToolsSwingLocator.getWindowManager()
     windowManager.showWindow(panel, getTitle(), windowManager.MODE.WINDOW)
Exemplo n.º 4
0
 def showAccidentsSearch(self):
     dataSwingManager = DALSwingLocator.getSwingManager()
     dataManager = DALLocator.getDataManager()
     winManager = ToolsSwingLocator.getWindowManager()
     workspace = dataManager.getDatabaseWorkspace("ARENA2_DB")
     if workspace == None:
         msgbox("Debera conectarse al espacio de trabajo de ARENA2_DB")
         return
     repo = workspace.getStoresRepository()
     store = repo.getStore("ARENA2_ACCIDENTES")
     panel = dataSwingManager.createFeatureStoreSearchPanel(store)
     winManager.showWindow(panel.asJComponent(), "Busqueda de accidentes",
                           WindowManager.MODE.WINDOW)
Exemplo n.º 5
0
def main(*args):
    i18n = ToolsLocator.getI18nManager()
    layer = currentLayer()
    if layer == None:
        msgbox(i18n.getTranslation("_Need_a_vector_layer_selected_in_the_ToC"))
        return
    panel = AddTimeSupport(currentLayer())

    winmgr = ToolsSwingLocator.getWindowManager()
    dialog = winmgr.createDialog(
        panel.asJComponent(), i18n.getTranslation("_Add_basic_time_support"),
        i18n.getTranslation("_Add_basic_time_support_to_vectorial_layer"),
        winmgr.BUTTONS_OK_CANCEL)
    dialog.addActionListener(panel)
    dialog.show(winmgr.MODE.WINDOW)
Exemplo n.º 6
0
    def actionPerformed(self, *args):
        winmgr = ToolsSwingLocator.getWindowManager()
        if self.dialog.getAction() == winmgr.BUTTON_CANCEL:
            self.taskStatus.terminate()
            return
        if self.dialog.getAction() == winmgr.BUTTON_OK:
            table1 = self.panel.getTable1()
            table2 = self.panel.getTable2()
            field1 = self.panel.getField1().getName()
            field2 = self.panel.getField2().getName()

            data = self.panel.getFieldsToUse()
            translator = self.panel.getTranslator()
            thread.start_new_thread(
                self.process,
                (table1, field1, table2, field2, data, translator))
Exemplo n.º 7
0
    def execute(self, actionCommand, *args):
        self.panel = ImportFieldPanel()
        self.panel.setPreferredSize(400, 300)
        i18nManager = ToolsLocator.getI18nManager()
        winmgr = ToolsSwingLocator.getWindowManager()
        self.taskStatus = ToolsLocator.getTaskStatusManager(
        ).createDefaultSimpleTaskStatus(
            i18nManager.getTranslation("_Import_fields"))
        self.taskStatus.setAutoremove(True)

        self.dialog = winmgr.createDialog(
            self.panel.asJComponent(),
            i18nManager.getTranslation("_Import_fields"),
            i18nManager.getTranslation("_Select_fields_to_import_into_table"),
            winmgr.BUTTONS_OK_CANCEL)
        self.dialog.addActionListener(self)
        self.dialog.show(WindowManager.MODE.WINDOW)
def main(*args):
    viewDoc = gvsig.currentView()
    layer = viewDoc.getLayer("manzanas_pob")
    layer = gvsig.currentLayer()
    panel = ReportByPointPanel(layer)
    panel.setPreferredSize(400, 300)

    winmgr = ToolsSwingLocator.getWindowManager()
    dialog = winmgr.createDialog(panel.asJComponent(), "ReportByPoint test",
                                 "ReportByPoint information",
                                 winmgr.BUTTONS_OK_CANCEL)
    dialog.show(winmgr.MODE.DIALOG)
    if dialog.getAction() == winmgr.BUTTON_OK:
        panel.save()
        print "Ok"
        print "Show field: "
    else:
        print "Cancel"
 def execute(self,actionCommand, *args):
   actionCommand = actionCommand.lower()
   if actionCommand == "view-time-add-basic-support-to-datasource":
     i18n = ToolsLocator.getI18nManager()
     layer = currentLayer()
     if layer == None:
       msgbox(i18n.getTranslation("_Need_a_vector_layer_selected_in_the_ToC"))
       return 
     panel = AddTimeSupport(currentLayer())
   
     winmgr = ToolsSwingLocator.getWindowManager()
     dialog = winmgr.createDialog(
       panel.asJComponent(),
       i18n.getTranslation("_Add_basic_time_support"),
       i18n.getTranslation("_Add_basic_time_support_to_vectorial_layer"),
       winmgr.BUTTONS_OK_CANCEL
     )
     dialog.addActionListener(panel)
     dialog.show(winmgr.MODE.WINDOW)
Exemplo n.º 10
0
def main(*args):
    panel = ImportFieldPanel()
    panel.setPreferredSize(400, 300)

    winmgr = ToolsSwingLocator.getWindowManager()
    dialog = winmgr.createDialog(panel.asJComponent(), "ReportByPoint test",
                                 "ReportByPoint information",
                                 winmgr.BUTTONS_OK_CANCEL)
    dialog.show(winmgr.MODE.DIALOG)
    if dialog.getAction() == winmgr.BUTTON_OK:
        table1 = panel.getTable1()
        table2 = panel.getTable2()
        field1 = panel.getField1()
        field2 = panel.getField2()

        data = panel.getFieldsToUse()
        translator = panel.getTranslator()
        processImportFields(table1, field1.getName(), table2, field2.getName(),
                            data, translator)
    else:
        pass
    def execute(self, actionCommand, *args):
        self.document = gvsig.currentDocument(TableManager.TYPENAME)

        if self.document == None:
            return

        i18nManager = ToolsLocator.getI18nManager()

        self.store = self.document.getFeatureStore()
        ## Previusly editing state
        if self.store.isEditing():
            self.editingMode = True
        else:
            self.editingMode = False
        ## Analyce pending changes
        if self.store.getPendingChangesCount() > 0:
            message = i18nManager.getTranslation(
                "_info_confirm_dialog_field_calculator_commit_changes")
            title = ""
            optionType = commonsdialog.WARNING
            messageType = commonsdialog.WARNING
            msgid = "_field_calculator_save_pending_changes_at_finish"
            optionSave = ApplicationLocator.getManager().confirmDialog(
                message, title, optionType, messageType, msgid)
            if optionSave == commonsdialog.YES:
                pass
            else:
                logger(
                    "User changes are not commited and FieldCalculator will commit all this changes",
                    LOGGER_WARN)
                return
        ##

        name = i18nManager.getTranslation(
            "_Field_Calculator_Tool") + ": " + self.store.getName()
        self.taskStatus = ToolsLocator.getTaskStatusManager(
        ).createDefaultSimpleTaskStatus("")
        self.taskStatus.setAutoremove(True)
        windowManager = ToolsSwingLocator.getWindowManager()

        # Set first column option
        defaultField = None
        #table = gvsig.currentDocument(TableManager.TYPENAME)
        if self.document != None:
            selected = self.document.getMainWindow().getTablePanel().getTable(
            ).getSelectedColumnsAttributeDescriptor()
            if len(selected) >= 1:
                defaultField = selected[0].getName()

        # Open tool

        #prefs = readConfigFile()
        self.tool = FieldCalculatorTool(self.store, self.taskStatus,
                                        defaultField)

        self.expBuilder = self.tool.getExpBuilder()
        self.expFilter = self.tool.getExpFilter()

        self.dialog = windowManager.createDialog(
            self.tool.asJComponent(), name, None,
            WindowManager_v2.BUTTON_CANCEL | WindowManager_v2.BUTTON_APPLY)
        self.dialog.addActionListener(self)
        self.dialog.show(WindowManager.MODE.WINDOW)

        self.dialog.setButtonLabel(WindowManager_v2.BUTTON_CANCEL,
                                   i18nManager.getTranslation("_close"))
        columnSelectedDescriptor = self.tool.getFieldDescriptor()
        if columnSelectedDescriptor == None:
            self.dialog.setButtonEnabled(WindowManager_v2.BUTTON_APPLY, False)

        self.tool.setDialog(self.dialog)