Subversion Repositories basico

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 t00mlabs 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
# File: settings.py
4
# Author: Tomás Vírseda
5
# License: GPL v3
6
# Description: Settings service
7
 
8
 
9
from gi.repository import Gtk
10
from gi.repository import Gio
11
from gi.repository import Pango
12
from gi.repository.GdkPixbuf import Pixbuf
13
 
14
from .service import Service
15
 
74 t00mlabs 16
# Default settings for SAP module
17
LOGIN_PAGE_URL = "https://accounts.sap.com"
18
LOGOUT_PAGE_URL = "https://accounts.sap.com/ui/logout"
19
ODATA_NOTE_URL = "https://launchpad.support.sap.com/services/odata/svt/snogwscorr/TrunkSet(SapNotesNumber='%s',Version='0',Language='E')" #$expand=LongText" #?$expand=LongText,RefTo,RefBy"
20
SAP_NOTE_URL = "https://launchpad.support.sap.com/#/notes/%s"
21
SAP_NOTE_URL_PDF = "https://launchpad.support.sap.com/services/pdf/notes/%s/E"
22
TIMEOUT = 5
23
 
24
 
4 t00mlabs 25
class Settings(Service):
26
    def initialize(self):
27
        view = self.get_config_value('View')
74 t00mlabs 28
        self.log.debug("View: %s" % view)
29
 
30
    def get_default_settings(self):
31
        settings = {}
32
        # Deprecated as Basico uses now login with SAP Passport
33
        #~ settings['CNF_SAP_SUser'] = 'SXXXXXXXXXX'
34
        #~ settings['CNF_SAP_SPass'] = 'MyP455w0rD'
35
        utils = self.get_service('Utils')
36
        settings['CNF_SAP_LOGIN'] = LOGIN_PAGE_URL
37
        settings['CNF_SAP_LOGOUT'] = LOGOUT_PAGE_URL
38
        settings['CNF_SAP_ODATA_NOTES'] = ODATA_NOTE_URL
39
        settings['CNF_SAP_NOTE_URL'] = SAP_NOTE_URL
40
        settings['CNF_SAP_CONN_TIMEOUT'] = TIMEOUT
41
        settings['CNF_FF_PROFILE_DIR'] = utils.get_firefox_profile_dir()
42
 
43
        return settings
44
 
45
 
46
    def get_custom_settings(self):
47
        sap = self.get_service('SAP')
48
        utils = self.get_service('Utils')
49
 
50
        settings = {}
51
        settings['CNF_SAP_LOGIN'] = sap.get_config_value('CNF_SAP_LOGIN')
52
        settings['CNF_SAP_LOGOUT'] = sap.get_config_value('CNF_SAP_LOGOUT')
53
        settings['CNF_SAP_ODATA_NOTES'] = sap.get_config_value('CNF_SAP_ODATA_NOTES')
54
        settings['CNF_SAP_NOTE_URL'] = sap.get_config_value('CNF_SAP_NOTE_URL')
55
        settings['CNF_SAP_CONN_TIMEOUT'] = sap.get_config_value('CNF_SAP_CONN_TIMEOUT')
56
        settings['CNF_FF_PROFILE_DIR'] = sap.get_config_value('CNF_FF_PROFILE_DIR')
57
 
58
        return settings