예제 #1
0
def showDesigner():

    fixFormPanelResourceLoader()

    initDataFolder()

    registerFactory(MobileFormItemUnknownFactory())
    registerFactory(MobileFormItemBooleanFactory())
    registerFactory(MobileFormItemStringFactory())
    registerFactory(MobileFormItemDoubleFactory())
    registerFactory(MobileFormItemDateFactory())
    registerFactory(MobileFormItemIntegerFactory())
    registerFactory(MobileFormItemStringComboFactory())
    registerFactory(MobileFormItemMultiStringComboFactory())
    registerFactory(MobileFormItemTimeFactory())
    registerFactory(MobileFormItemSketchFactory())
    registerFactory(MobileFormItemPicturesFactory())
    registerFactory(MobileFormItemHiddenFactory())
    registerFactory(MobileFormItemPrimaryKeyFactory())
    registerFactory(MobileFormItemLabelFactory())
    registerFactory(MobileFormItemLabelWithLineFactory())
    registerFactory(MobileFormItemDynamicStringFactory())
    registerFactory(MobileFormItemConnectedStringComboFactory())
    registerFactory(MobileFormItemMapFactory())

    designer = Designer()
    designer.showWindow(getTitle())
 def btnAdd_click(self, *args):
     model = self.lstValues.getModel()
     index = self.lstValues.getModel().getSize()
     item = inputbox("Item",
                     getTitle(),
                     messageType=QUESTION,
                     initialValue="item %s" % index)
     model.addElement(item)
예제 #3
0
 def btnFileNew_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     if confirmDialog(i18n.getTranslation(
             "_Are_you_sure_you_want_to_abandon_the_changes"),
                      getTitle(),
                      optionType=YES_NO,
                      messageType=QUESTION) != YES:
         return
     self.newSections()
예제 #4
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)
예제 #5
0
 def btnAdd_click(self, *args):
     model = self.lstValues.getModel()
     index = model.getSize() + 1
     item = inputbox("Item",
                     getTitle(),
                     messageType=QUESTION,
                     initialValue="item %s" % index)
     if item == None:
         return
     model.addElement(item)
     self.form.fetchValuesFromSubcombo()
 def btnDelete_click(self, *args):
     model = self.lstValues.getModel()
     index = self.lstValues.getSelectedIndex()
     if index < 0:
         return
     if confirmDialog(
             u"¿ Seguro que desea eliminar el elemento seleccionado ?",
             getTitle(),
             optionType=YES_NO,
             messageType=QUESTION) != YES:
         return
     model.removeElementAt(index)
     self.lstValues.setSelectedIndex(index)
예제 #7
0
 def btnFileSaveAs_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     if self.__sections == None or len(self.__sections) < 1:
         msgbox(i18n.getTranslation(
             "_You_must_define_some_section_before_saving"),
                getTitle(),
                messageType=WARNING)
         return
     if self.__currentSection == None or len(self.__currentSection) < 1:
         msgbox(i18n.getTranslation(
             "_You_must_define_some_form_before_saving"),
                getTitle(),
                messageType=WARNING)
         return
     f = saveFileDialog(
         i18n.getTranslation("_Select_the_Tags_file_to_write"),
         initialPath=self.__lastPath)
     if f == None:
         return
     fname = f[0]
     self.updateSectionFromUI()
     self.saveSections(fname)
예제 #8
0
 def btnAdd_click(self, *args):
     model = self.lstValues.getModel()
     index = model.getSize() + 1
     item = inputbox("Item",
                     getTitle(),
                     messageType=QUESTION,
                     initialValue="item %s" % index)
     if item == None:
         return
     newItem = ItemWithSubitems(item)
     model.addElement(newItem)
     self.lstValues.setSelectedIndex(index - 1)
     self.form.putValuesInSubcombo()
예제 #9
0
 def btnFormRename_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     index = self.cboForms.getSelectedIndex()
     if index < 0:
         return
     formName = inputbox(i18n.getTranslation("_Form_name"),
                         getTitle(),
                         messageType=QUESTION,
                         initialValue=self.__currentForm.getName())
     if formName == None:
         return
     self.__currentSection[index].setName(formName)
     self.updateSectionFromUI()
     self.cboForms.setSelectedIndex(index)
예제 #10
0
 def btnFormDelete_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     index = self.cboForms.getSelectedIndex()
     if index < 0:
         return
     if confirmDialog(i18n.getTranslation(
             "_Are_you_sure_you_want_to_delete_the_selected_form_%s") %
                      self.__currentSection[index],
                      getTitle(),
                      optionType=YES_NO,
                      messageType=QUESTION) != YES:
         return
     del self.__currentSection[index]
     self.updateSectionFromUI()
예제 #11
0
 def btnFormItemDelete_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     index = self.lstFormItems.getSelectedIndex()
     if index < 0:
         return
     if confirmDialog(i18n.getTranslation(
             "_Are_you_sure_you_want_to_delete_the_selected_item"),
                      getTitle(),
                      optionType=YES_NO,
                      messageType=QUESTION) != YES:
         return
     form = self.__currentForm
     items = form.items()
     del items[index]
     self.updateListOfFormItems(form)
     self.lstFormItems.setSelectedIndex(index)
예제 #12
0
 def btnFormAdd_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     if self.__currentForm == None:
         index = 0
     else:
         index = len(self.__currentSection)
     formName = inputbox(i18n.getTranslation("_Form_name"),
                         getTitle(),
                         messageType=QUESTION,
                         initialValue=i18n.getTranslation("_Form_%s") %
                         index)
     if formName == None:
         return
     form = Form(formName)
     self.__currentSection.append(form)
     self.updateSectionFromUI()
     self.cboForms.setSelectedIndex(len(self.__currentSection) - 1)
예제 #13
0
 def btnSectionAdd_click(self, *args):
     i18n = ToolsLocator.getI18nManager()
     if self.__currentSection == None:
         index = 0
     else:
         index = len(self.__sections)
     name = inputbox(i18n.getTranslation("_Section_name"),
                     getTitle(),
                     messageType=QUESTION,
                     initialValue=i18n.getTranslation("_Section_%s") %
                     index)
     if name == None:
         return
     section = Section(name)
     self.__sections.append(section)
     self.updateSectionFromUI()
     self.cboSections.setSelectedIndex(len(self.__sections) - 1)
예제 #14
0
    def loadSections(self, fname):
        sections = Sections()
        sections.load(fname)
        self.setSections(sections)
        self.__lastPath = os.path.dirname(fname)
        self.btnFileSave.setEnabled(True)
        self.txtPathName.setText(self.__sections.getFilename())
        unsupported = dict()
        for section in sections:
            for form in section:
                for item in form.items():
                    if isinstance(item, MobileFormItemUnknown):
                        unsupported[item.getRealType()] = item.getRealType()

        if len(unsupported) > 0:
            i18n = ToolsLocator.getI18nManager()
            msgbox(i18n.getTranslation("_Some_elements_are_not_supported") +
                   "\n" + i18n.getTranslation(
                       "_Save_in_another_file_to_avoid_losing_those_values") +
                   "\n" + str(unsupported.values()),
                   getTitle(),
                   messageType=WARNING)
            self.__sections.setFilename(None)