Exemplo n.º 1
0
    def __init__(self):
        self._cfgFile = pathtools.convertPath(
            pathtools.getPathProgramFolder() + 'tools/settings.cfg')
        self._config = ConfigParser.RawConfigParser()
        self._config.read(self._cfgFile)

        if not os.path.exists(self._cfgFile) :
            cfg = open(self._cfgFile,'w')
            cfg.write('[settings]\npath_bd = ')
            cfg.close()
Exemplo n.º 2
0
    def __init__(self):
        self._cfgFile = pathtools.convertPath(
            pathtools.getPathProgramFolder() + 'tools/settings.cfg')
        self._config = ConfigParser.RawConfigParser()
        self._config.read(self._cfgFile)

        if not os.path.exists(self._cfgFile):
            cfg = open(self._cfgFile, 'w')
            cfg.write('[settings]\npath_bd = ')
            cfg.close()
Exemplo n.º 3
0
def loadUI(self, pathToFile=None):
    '''
    Read and load the screen indicate by <pathToFile>

    @param {str} pathToFile = path to .ui file
        If is None, look the ui in the location
        relative to the current folder
    '''
    from plasta.config import config
    from PyQt4 import uic
    from plasta.utils import pathtools
    if pathToFile is None:
       pathToFile = self.FILENAME
    if config.DEVELOP:
        mainFolder = pathtools.getPathProgramFolder()
        uic.loadUi(pathtools.convertPath(mainFolder + pathToFile), self)
    else:
        import cStringIO, uis
        uic.loadUi(cStringIO.StringIO(uis[pathToFile]), self)
Exemplo n.º 4
0
def loadUI(self, pathToFile=None):
    '''
    Read and load the screen indicate by <pathToFile>

    @param {str} pathToFile = path to .ui file
        If is None, look the ui in the location
        relative to the current folder
    '''
    from plasta.config import config
    from PyQt4 import uic
    from plasta.utils import pathtools
    if pathToFile is None:
       pathToFile = self.FILENAME
    if config.DEVELOP:
        mainFolder = pathtools.getPathProgramFolder()
        uic.loadUi(pathtools.convertPath(mainFolder + pathToFile), self)
    else:
        import cStringIO, uis
        uic.loadUi(cStringIO.StringIO(uis[pathToFile]), self)
Exemplo n.º 5
0
def __generarPlantilla(destino, tipo, metodos=None):
    """
    {str} tipo = Dialog | MainWindow
    """
    nombre_archivo = os.path.basename(destino).split(".")[0] + ".py"
    ruta_destino = pathtools.convertPath(os.path.dirname(destino) + "/" + nombre_archivo)
    shutil.copyfile(pathtools.convertPath(pathtools.getPathProgramFolder() + "plantillas/plantilla.py"), ruta_destino)

    archivo = open(ruta_destino, "r")
    contenido = archivo.read()
    archivo.close()

    # reemplaza en el texto los campos de la plantilla
    contenido = contenido.replace(u"%%%", tipo)
    contenido = contenido.replace(u"&&&", os.path.basename(destino).split(".")[0])
    archivo = open(ruta_destino, "w")
    archivo.write(contenido)
    archivo.close()
    print ">>> Plantilla .py generada"
    return True
Exemplo n.º 6
0
def __generarPlantilla(destino, tipo, metodos=None):
    """
    {str} tipo = Dialog | MainWindow
    """
    nombre_archivo = os.path.basename(destino).split('.')[0] + '.py'
    ruta_destino = pathtools.convertPath(
        os.path.dirname(destino) + '/' + nombre_archivo)
    shutil.copyfile(
        pathtools.convertPath(pathtools.getPathProgramFolder() +
                              'plantillas/plantilla.py'), ruta_destino)

    archivo = open(ruta_destino, 'r')
    contenido = archivo.read()
    archivo.close()

    # reemplaza en el texto los campos de la plantilla
    contenido = contenido.replace(u'%%%', tipo)
    contenido = contenido.replace(u'&&&',
                                  os.path.basename(destino).split('.')[0])
    archivo = open(ruta_destino, 'w')
    archivo.write(contenido)
    archivo.close()
    print '>>> Plantilla .py generada'
    return True
Exemplo n.º 7
0
#   The above copyright notice and this permission notice shall be included in
#   all copies or substantial portions of the Software.
#
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#   THE SOFTWARE.

from plasta.utils import pathtools

#############################################################################################

_thisFolder = pathtools.getPathProgramFolder() + pathtools.convertPath(
    'plasta/maker/templates/object')[1:]

_meta = {
    'widgets': {
        'lineEdit': 'le',
        'comboBox': 'cb',
        'spinBox': 'sb',
        'doubleSpinBox': 'dsb',
        'textEdit': 'te',
        'dateEdit': 'dt',
        'dateTimeEdit': 'dte',
        'timeEdit': 'tme',
        'checkBox': 'chk',
    }
}
Exemplo n.º 8
0
#   The above copyright notice and this permission notice shall be included in
#   all copies or substantial portions of the Software.
#
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#   THE SOFTWARE.

from plasta.utils import pathtools

#############################################################################################

_thisFolder = pathtools.getPathProgramFolder() + pathtools.convertPath('plasta/maker/templates/object')[1:]

_meta = {
  'widgets':{
    'lineEdit':'le',
    'comboBox':'cb',
    'spinBox':'sb',
    'doubleSpinBox':'dsb',
    'textEdit':'te',
    'dateEdit':'dt',
    'dateTimeEdit':'dte',
    'timeEdit':'tme',
    'checkBox':'chk',
  }
}