Exemple #1
0
def load_characters(party, screen, predraw=None, delete_file=True, max_party_size=4):
    file_list = glob.glob(util.user_dir("c_*.sav"))
    pc_list = []
    charsheets = dict()
    for fname in file_list:
        with open(fname, "rb") as f:
            pc = cPickle.load(f)
        if pc:
            pc_list.append(pc)
            charsheets[pc] = charsheet.CharacterSheet(pc, screen=screen)
    psr = charsheet.PartySelectRedrawer(
        charsheets=charsheets, predraw=predraw, screen=screen, caption="Select Party Members"
    )
    while len(party) < max_party_size:
        rpm = charsheet.RightMenu(screen, predraw=psr, add_desc=False)
        psr.menu = rpm
        for pc in pc_list:
            rpm.add_item(str(pc), pc)
        rpm.sort()
        rpm.add_alpha_keys()
        pc = rpm.query()

        if pc:
            pc_list.remove(pc)
            party.append(pc)
            if delete_file:
                pc.backup()
                os.remove(util.user_dir("c_{}.sav".format(pc.name)))
        else:
            break
    return party
Exemple #2
0
def handle_anim_sequence( screen, view, anims, record_anim=False ):
    tick = 0
    if record_anim:
        view.anims.clear()
        view( screen, show_quick_stats=False )
        pygame.display.flip()
        pygame.image.save( screen, util.user_dir( "anim_{:0>3}.png".format(tick) ) )
        tick += 1

    while anims:
        view.anims.clear()
        for a in anims[:]:
            if a.needs_deletion:
                anims.remove( a )
                anims += a.children
            else:
                view.anims[a.pos].append( a )
                a.update()
        view( screen, show_quick_stats=False )
        pygame.display.flip()
        if record_anim:
            pygame.image.save( screen, util.user_dir( "anim_{:0>3}.png".format(tick) ) )

        pygwrap.anim_delay()
        tick += 1
    view.anims.clear()
Exemple #3
0
def handle_anim_sequence(screen, view, anims, record_anim=False):
    tick = 0
    if record_anim:
        view.anims.clear()
        view(screen, show_quick_stats=False)
        pygame.display.flip()
        pygame.image.save(screen,
                          util.user_dir("anim_{:0>3}.png".format(tick)))
        tick += 1

    while anims:
        view.anims.clear()
        for a in anims[:]:
            if a.needs_deletion:
                anims.remove(a)
                anims += a.children
            else:
                view.anims[a.pos].append(a)
                a.update()
        view(screen, show_quick_stats=False)
        pygame.display.flip()
        if record_anim:
            pygame.image.save(screen,
                              util.user_dir("anim_{:0>3}.png".format(tick)))

        pygwrap.anim_delay()
        tick += 1
    view.anims.clear()
def fix_characters():
    file_list = glob.glob( util.user_dir( "c_*.sav" ) )
    for fname in file_list:
        f = open( fname, "rb" )
        pc = cPickle.load( f )
        f.close()

        pc.stat_damage = collections.defaultdict(int)

        f = open( util.user_dir( "c_" + pc.name + ".sav" ) , "wb" )
        cPickle.dump( pc , f, -1 )
        f.close()
Exemple #5
0
def fix_characters():
    file_list = glob.glob( util.user_dir( "c_*.sav" ) )
    for fname in file_list:
        f = open( fname, "rb" )
        pc = cPickle.load( f )
        f.close()

        pc.stat_damage = collections.defaultdict(int)

        f = open( util.user_dir( "c_" + pc.name + ".sav" ) , "wb" )
        cPickle.dump( pc , f, -1 )
        f.close()
Exemple #6
0
def browse_pcs(screen):
    ''' Look at the previously created characters.
    Start by loading all characters from disk.
    '''

    file_list = glob.glob(util.user_dir("c_*.sav"))
    pc_list = []
    charsheets = dict()
    for fname in file_list:
        with open(fname, "rb") as f:
            pc = cPickle.load(f)
        if pc:
            pc_list.append(pc)
            charsheets[pc] = charsheet.CharacterSheet(pc, screen=screen)
    if pc_list:
        # adds party members to charsheet
        psr = charsheet.PartySelectRedrawer(charsheets=charsheets,
                                            screen=screen,
                                            caption="Browse Characters")
        rpm = charsheet.RightMenu(screen, predraw=psr, add_desc=False)
        psr.menu = rpm
        for pc in pc_list:
            rpm.add_item(str(pc), pc)
        rpm.sort()
        pc = rpm.query()
Exemple #7
0
def wait_event():
    # Wait for input, then return it when it comes.
    ev = pygame.event.wait()

    # Android-specific:
    if android:
        if android.check_pause():
            android.wait_for_resume()

    # Record if a quit event took place
    if ev.type == pygame.QUIT:
        my_state.got_quit = True
    elif ev.type == TIMEREVENT:
        pygame.event.clear(TIMEREVENT)
    elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_PRINT:
        pygame.image.save(my_state.screen, util.user_dir("out.png"))
    elif ev.type == pygame.VIDEORESIZE:
        my_state.screen = pygame.display.set_mode(
            (max(ev.w, 800), max(ev.h, 600)), pygame.RESIZABLE)

    # Inform any interested widgets of the event.
    my_state.widget_clicked = False
    if my_state.widgets_active:
        for w in my_state.widgets:
            w.respond_event(ev)

    return ev
Exemple #8
0
def toggle_fullscreen_default(screen, rpm):
    scrsize = width, height = 600, 400
    fullscreen_sz = pygame.display.Info().current_w, pygame.display.Info(
    ).current_h
    x = pygame.display.Info().current_w
    win_pos_left = 1 + ((fullscreen_sz[0] - width) // 2)
    win_pos_top = 1 + ((fullscreen_sz[1] - height) // 2)
    os.environ['SDL_VIDEO_WINDOW_POS'] = '{0},{1}'.format(
        win_pos_left, win_pos_top)  #reset enviroment varibles

    if util.config.getboolean("DEFAULT",
                              "fullscreen"):  #checks fullscreen in config.cfg
        util.config.set("DEFAULT", "fullscreen",
                        "False")  #changes fullscreen in config.cfg buffer
        pygame.display.set_mode((800, 600))  #change current display flag
        rpm.predraw(screen)
    else:
        util.config.set("DEFAULT", "fullscreen", "True")
        pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
        rpm.predraw(screen)

    #write changes in config.cfg to file
    with open(util.user_dir("config.cfg"), "wb") as f:
        util.config.write(f)
    #update display with new flags
    pygame.display.update()

    return 0
def wait_event():
    # Wait for input, then return it when it comes.
    ev = pygame.event.wait()

    # Android-specific:
    if android:
        if android.check_pause():
            android.wait_for_resume()

    # Record if a quit event took place
    if ev.type == pygame.QUIT:
        my_state.got_quit = True
    elif ev.type == TIMEREVENT:
        pygame.event.clear( TIMEREVENT )
    elif ev.type == pygame.KEYDOWN:
        if ev.key == pygame.K_PRINT:
            pygame.image.save( my_state.screen, util.user_dir( "out.png" ) )
        elif ev.key in my_state.get_keys_for("next_widget"):
            my_state.active_widget_hilight = True
            my_state.activate_next_widget()
    elif ev.type == pygame.VIDEORESIZE:
        my_state.screen = pygame.display.set_mode( (max(ev.w,800),max(ev.h,600)), pygame.RESIZABLE )

    # Inform any interested widgets of the event.
    my_state.widget_clicked = False
    if my_state.widgets_active:
        for w in my_state.widgets:
            w.respond_event(ev)

    return ev
Exemple #10
0
    def electrum_path(self):
        # Read electrum_cash_path from command line / system configuration
        # Otherwise use the user's default data directory.
        path = self.get('electron_cash_path')
        if path is None:
            path = self.user_dir()

        if self.get('testnet'):
            path = os.path.join(path, 'testnet')

        # Make directory if it does not yet exist.
        if not os.path.exists(path):
            if os.path.islink(path):
                raise BaseException('Dangling link: ' + path)
            self.print_error("Making directory {} and copying wallets".format(path))
            os.makedirs(path)
            electrum_path = user_dir(True)
            if self.get('testnet'):
                electrum_path = os.path.join(electrum_path, 'testnet')
            if os.path.exists(electrum_path):
                # Deliberately don't copy config
                shutil.copytree(os.path.join(electrum_path, 'wallets'), os.path.join(path, 'wallets'))
        obsolete_file = os.path.join(path, 'recent_servers')
        if os.path.exists(obsolete_file):
            os.remove(obsolete_file)
        self.print_error("electron-cash directory", path)
        return path
    def __init__(self, options={}):

        # system conf, readonly
        self.system_config = {}
        if options.get('portable') == False:
            self.read_system_config()

        # user conf, writeable
        self.user_dir = user_dir()
        self.user_config = {}
        if options.get('portable') == False:
            self.read_user_config()

        # command-line options
        self.options_config = options

        self.wallet_config = {}
        self.wallet_file_exists = False
        self.init_path(self.options_config.get('wallet_path'))
        print_error( "path", self.path )
        if self.path:
            self.read_wallet_config(self.path)

        # portable wallet: use the same directory for wallet and headers file
        if options.get('portable'):
            self.wallet_config['blockchain_headers_path'] = os.path.dirname(self.path)
Exemple #12
0
    def init_path(self, options):
        """Set the path of the wallet."""

        path = None
        if options:
            # this will call read_wallet_config only if there is a wallet_path value in options
            try:
                path = options.wallet_path
            except:
                pass

        if not path:
            path = self.get('default_wallet_path')

        if path is not None:
            self.path = path
            return

        # Look for wallet file in the default data directory.
        # Keeps backwards compatibility.
        wallet_dir = user_dir()

        # Make wallet directory if it does not yet exist.
        if not os.path.exists(wallet_dir):
            os.mkdir(wallet_dir)
        self.path = os.path.join(wallet_dir, "electrum.dat")
Exemple #13
0
def make_and_save_character(screen):
    pc = make_character(screen)
    if pc:
        f = open(util.user_dir("c_" + pc.name + ".sav"), "wb")
        cPickle.dump(pc, f, -1)
        f.close()
    return pc
    def __init__(self, options={}):

        # system conf, readonly
        self.system_config = {}
        if options.get('portable') == False:
            self.read_system_config()

        # user conf, writeable
        self.user_dir = user_dir()
        self.user_config = {}
        if options.get('portable') == False:
            self.read_user_config()

        # command-line options
        self.options_config = options

        self.wallet_config = {}
        self.wallet_file_exists = False
        self.init_path(self.options_config.get('wallet_path'))
        print_error("path", self.path)
        if self.path:
            self.read_wallet_config(self.path)

        # portable wallet: use the same directory for wallet and headers file
        if options.get('portable'):
            self.wallet_config['blockchain_headers_path'] = os.path.dirname(
                self.path)
Exemple #15
0
def load_party( screen ):
    # Select up to four characters to form the new party.
    # Start by loading all characters from disk.
    file_list = glob.glob( util.user_dir( "c_*.sav" ) )
    pc_list = []
    charsheets = dict()
    party = []
    for fname in file_list:
        f = open( fname, "rb" )
        pc = cPickle.load( f )
        f.close()
        if pc:
            pc_list.append( pc )
            charsheets[ pc ] = charsheet.CharacterSheet( pc , screen=screen )

    psr = charsheet.PartySelectRedrawer( charsheets=charsheets, screen=screen, caption="Select Party Members" )
    for t in range( 4 ):
        rpm = charsheet.RightMenu( screen, predraw=psr, add_desc=False )
        psr.menu = rpm
        for pc in pc_list:
            rpm.add_item( str( pc ), pc )
        rpm.sort()
        rpm.add_alpha_keys()
        pc = rpm.query()

        if pc:
            pc_list.remove( pc )
            party.append( pc )
        else:
            break

    return party
Exemple #16
0
 def __init__(self):
     # Find electrum data folder
     self.config_folder = user_dir()
     self.config = self.default_options
     # Read the file
     if os.path.exists(self.config_file_path()):
         self.load_config()
     self.save_config()
Exemple #17
0
 def __init__(self):
     # Find electrum data folder
     self.config_folder = user_dir()
     self.config = self.default_options
     # Read the file
     if os.path.exists(self.config_file_path()):
         self.load_config()
     self.save_config()
Exemple #18
0
def Delete_saved_games(screen):
    rpm = rpgmenu.Menu( screen,screen.get_width()//2-250,screen.get_height()//2-50,500,100,predraw=PosterRedraw(screen) )
    rpm.add_files(util.user_dir("rpg_*.sav"))
    rpm.sort()
    rpm.add_alpha_keys()
    rpm.add_item("Cancel Delete Saved Games", None)
    cmd = rpm.query()
    if cmd:
        os.remove(cmd)
Exemple #19
0
    def save_user_config(self):
        import ConfigParser
        config = ConfigParser.RawConfigParser()
        config.add_section('client')
        for k,v in self.user_config.items():
            config.set('client', k, v)

        with open( os.path.join( user_dir(), 'electrum.conf'), 'wb') as configfile:
            config.write(configfile)
Exemple #20
0
 def backup_wallet(self):
     try:
       folderName = QFileDialog.getExistingDirectory(QWidget(), 'Select folder to save a copy of your wallet to', os.path.expanduser('~/'))
       if folderName:
         sourceFile = util.user_dir() + '/electrum.dat'
         shutil.copy2(sourceFile, str(folderName))
         QMessageBox.information(None,"Wallet backup created", "A copy of your wallet file was created in '%s'" % str(folderName))
     except (IOError, os.error), reason:
       QMessageBox.critical(None,"Unable to create backup", "Electrum was unable copy your wallet file to the specified location.\n" + str(reason))
Exemple #21
0
    def save_chunk(self, index, chunk):
        name = os.path.join( user_dir(), 'blockchain_headers')
        if os.path.exists(name):
            f = open(name,'rw+')
        else:
            f = open(name,'w+')

        f.seek(index*2016*80)
        h = f.write(chunk)
        f.close()
Exemple #22
0
 def read_header(self, block_height):
     name = os.path.join( user_dir(), 'blockchain_headers')
     if os.path.exists(name):
         f = open(name,'rb')
         f.seek(block_height*80)
         h = f.read(80)
         f.close()
         if len(h) == 80:
             h = self.header_from_string(h)
             return h 
Exemple #23
0
    def save_user_config(self):
        import ConfigParser

        config = ConfigParser.RawConfigParser()
        config.add_section("client")
        for k, v in self.user_config.items():
            config.set("client", k, v)

        with open(os.path.join(user_dir(), "electrum.conf"), "wb") as configfile:
            config.write(configfile)
Exemple #24
0
 def __init__(self):
     # Find electrum data folder
     self.config_folder = user_dir()
     # Read the file
     if os.path.exists(self.config_file_path()):
         self.load_config()
     else:
         self.config = self.default_options
         # Make config directory if it does not yet exist.
         if not os.path.exists(self.config_folder):
             os.mkdir(self.config_folder)
         self.save_config()
Exemple #25
0
 def __init__(self):
     # Find electrum data folder
     self.config_folder = user_dir()
     # Read the file
     if os.path.exists(self.config_file_path()):
         self.load_config()
     else:
         self.config = self.default_options
         # Make config directory if it does not yet exist.
         if not os.path.exists(self.config_folder):
             os.mkdir(self.config_folder)
         self.save_config()
Exemple #26
0
    def set_path(self, wallet_path):
        """Set the path of the wallet."""
        if wallet_path is not None:
            self.path = wallet_path
            return
        # Look for wallet file in the default data directory.
        # Keeps backwards compatibility.
        wallet_dir = user_dir()

        # Make wallet directory if it does not yet exist.
        if not os.path.exists(wallet_dir):
            os.mkdir(wallet_dir)
        self.path = os.path.join(wallet_dir, "electrum.dat")
Exemple #27
0
    def set_path(self, wallet_path):
        """Set the path of the wallet."""
        if wallet_path is not None:
            self.path = wallet_path
            return
        # Look for wallet file in the default data directory.
        # Keeps backwards compatibility.
        wallet_dir = user_dir()

        # Make wallet directory if it does not yet exist.
        if not os.path.exists(wallet_dir):
            os.mkdir(wallet_dir)
        self.path = os.path.join(wallet_dir, "electrum.dat")
Exemple #28
0
def load_campaign( screen ):
    rpm = rpgmenu.Menu( screen,screen.get_width()//2-250,screen.get_height()//2-50,500,100,predraw=PosterRedraw(screen) )
    rpm.add_files( util.user_dir("rpg_*.sav") )
    rpm.sort()
    rpm.add_alpha_keys()
    rpm.add_item( "Cancel Load Campaign", None )
    cmd = rpm.query()
    if cmd:
        pygwrap.please_stand_by( screen, "Loading..." )
        with open( cmd, "rb" ) as f:
            camp = cPickle.load( f )
        if camp:
            camp.play( screen )
Exemple #29
0
    def init_path(self):

        # Read electrum path in the system configuration
        self.path = self.system_config.get('electrum_path')

        # If not set, use the user's default data directory.
        if self.path is None:
            self.path = user_dir()

        # Make directory if it does not yet exist.
        if not os.path.exists(self.path):
            os.mkdir(self.path)

        print_error( "electrum directory", self.path)
Exemple #30
0
def load_campaign( screen ):
    rpm = rpgmenu.Menu( screen,screen.get_width()//2-250,screen.get_height()//2-50,500,100,predraw=PosterRedraw(screen) )
    rpm.add_files( util.user_dir("rpg_*.sav") )
    rpm.sort()
    rpm.add_alpha_keys()
    rpm.add_item( "Cancel Load Campaign", None )
    cmd = rpm.query()
    if cmd:
        pygwrap.please_stand_by( screen, "Loading..." )
        f = open( cmd, "rb" )
        camp = cPickle.load( f )
        f.close()
        if camp:
            camp.play( screen )
def load_characters(party,
                    screen,
                    predraw=None,
                    delete_file=True,
                    max_party_size=4):
    file_list = glob.glob(util.user_dir("c_*.sav"))
    pc_list = []
    charsheets = dict()
    for fname in file_list:
        f = open(fname, "rb")
        pc = cPickle.load(f)
        f.close()
        if pc:
            pc_list.append(pc)
            charsheets[pc] = charsheet.CharacterSheet(pc, screen=screen)
    psr = charsheet.PartySelectRedrawer(charsheets=charsheets,
                                        predraw=predraw,
                                        screen=screen,
                                        caption="Select Party Members")
    while len(party) < max_party_size:
        rpm = charsheet.RightMenu(screen, predraw=psr, add_desc=False)
        psr.menu = rpm
        for pc in pc_list:
            rpm.add_item(str(pc), pc)
        rpm.sort()
        rpm.add_alpha_keys()
        pc = rpm.query()

        if pc:
            pc_list.remove(pc)
            party.append(pc)
            if delete_file:
                pc.backup()
                os.remove(util.user_dir("c_{}.sav".format(pc.name)))
        else:
            break
    return party
Exemple #32
0
    def read_user_config(self):
        name = os.path.join(user_dir(), "electrum.conf")
        if os.path.exists(name):
            try:
                import ConfigParser
            except:
                print "cannot parse electrum.conf. please install ConfigParser"
                return

            p = ConfigParser.ConfigParser()
            p.read(name)
            try:
                for k, v in p.items("client"):
                    self.user_config[k] = v
            except ConfigParser.NoSectionError:
                pass
Exemple #33
0
 def backup_wallet(self):
     try:
         folderName = QFileDialog.getExistingDirectory(
             QWidget(), 'Select folder to save a copy of your wallet to',
             os.path.expanduser('~/'))
         if folderName:
             sourceFile = util.user_dir() + '/electrum.dat'
             shutil.copy2(sourceFile, str(folderName))
             QMessageBox.information(
                 None, "Wallet backup created",
                 "A copy of your wallet file was created in '%s'" %
                 str(folderName))
     except (IOError, os.error), reason:
         QMessageBox.critical(
             None, "Unable to create backup",
             "Electrum was unable copy your wallet file to the specified location.\n"
             + str(reason))
Exemple #34
0
    def init_path(self):

        # Read shuttle path in the command line configuration
        self.path = self.options_config.get('shuttle_path')

        # Read shuttle path in the system configuration
        if self.path is None:
            self.path = self.system_config.get('shuttle_path')

        # If not set, use the user's default data directory.
        if self.path is None:
            self.path = user_dir()

        # Make directory if it does not yet exist.
        if not os.path.exists(self.path):
            os.mkdir(self.path)

        print_error( "shuttle directory", self.path)
Exemple #35
0
    def __init__(self, options={}):

        # system conf, readonly
        self.system_config = {}
        self.read_system_config()

        # user conf, writeable
        self.user_dir = user_dir()
        self.user_config = {}
        self.read_user_config()

        # command-line options
        self.options_config = options

        self.wallet_config = {}
        self.wallet_file_exists = False
        self.init_path(self.options_config.get('wallet_path'))
        print_error( "path", self.path )
        if self.path:
            self.read_wallet_config(self.path)
Exemple #36
0
    def __init__(self, options={}):

        # system conf, readonly
        self.system_config = {}
        self.read_system_config()

        # user conf, writeable
        self.user_dir = user_dir()
        self.user_config = {}
        self.read_user_config()

        # command-line options
        self.options_config = options

        self.wallet_config = {}
        self.wallet_file_exists = False
        self.init_path(self.options_config.get('wallet_path'))
        print_error("path", self.path)
        if self.path:
            self.read_wallet_config(self.path)
Exemple #37
0
def wait_event():
    # Wait for input, then return it when it comes.
    ev = pygame.event.wait()

    # Android-specific:
    if android:
        if android.check_pause():
            android.wait_for_resume()

    # Record if a quit event took place
    if ev.type == pygame.QUIT:
        global GOT_QUIT
        GOT_QUIT = True
    elif ev.type == TIMEREVENT:
        pygame.event.clear( TIMEREVENT )
    elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_PRINT:
        pygame.image.save( my_state.screen, util.user_dir( "out.png" ) )
    elif ev.type == pygame.VIDEORESIZE:
        my_state.screen = pygame.display.set_mode( (max(ev.w,800),max(ev.h,600)), pygame.RESIZABLE )
    return ev
Exemple #38
0
def wait_event():
    # Wait for input, then return it when it comes.
    ev = pygame.event.wait()

    # Android-specific:
    if android:
        if android.check_pause():
            android.wait_for_resume()

    # Record if a quit event took place
    if ev.type == pygame.QUIT:
        global GOT_QUIT
        GOT_QUIT = True
    elif ev.type == TIMEREVENT:
        pygame.event.clear(TIMEREVENT)

    elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_PRINT:
        screen = pygame.display.get_surface()
        pygame.image.save(screen, util.user_dir("out.png"))

    return ev
Exemple #39
0
def wait_event():
    # Wait for input, then return it when it comes.
    ev = pygame.event.wait()

    # Android-specific:
    if android:
        if android.check_pause():
            android.wait_for_resume()

    # Record if a quit event took place
    if ev.type == pygame.QUIT:
        global GOT_QUIT
        GOT_QUIT = True
    elif ev.type == TIMEREVENT:
        pygame.event.clear( TIMEREVENT )

    elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_PRINT:
        screen = pygame.display.get_surface()
        pygame.image.save( screen, util.user_dir( "out.png" ) )

    return ev
Exemple #40
0
def browse_pcs( screen ):
    # Look at the previously created characters.
    # Start by loading all characters from disk.
    file_list = glob.glob( util.user_dir( "c_*.sav" ) )
    pc_list = []
    charsheets = dict()
    for fname in file_list:
        f = open( fname, "rb" )
        pc = cPickle.load( f )
        f.close()
        if pc:
            pc_list.append( pc )
            charsheets[ pc ] = charsheet.CharacterSheet( pc , screen=screen )
    if pc_list:
        psr = charsheet.PartySelectRedrawer( charsheets=charsheets, screen=screen, caption="Browse Characters" )
        rpm = charsheet.RightMenu( screen, predraw=psr, add_desc=False )
        psr.menu = rpm
        for pc in pc_list:
            rpm.add_item( str( pc ), pc )
        rpm.sort()
        pc = rpm.query()
Exemple #41
0
    def __init__(self, options={}):

        # system conf, readonly
        self.system_config = {}
        if options.get('portable') is not True:
            self.read_system_config()

        # read path
        self.path = self.system_config.get('electrum_path')
        if self.path is None:
            self.path = user_dir()

        # user conf, writeable
        self.user_config = {}
        if options.get('portable') == False:
            self.read_user_config()

        # command-line options
        self.options_config = options

        # init path
        self.init_path()

        print_error("electrum path", self.path)
Exemple #42
0
    def __init__(self, options={}):

        # system conf, readonly
        self.system_config = {}
        if options.get('portable') is not True:
            self.read_system_config()

        # read path
        self.path = self.system_config.get('electrum_path')
        if self.path is None:
            self.path = user_dir()

        # user conf, writeable
        self.user_config = {}
        if options.get('portable') == False:
            self.read_user_config()

        # command-line options
        self.options_config = options

        # init path
        self.init_path()

        print_error( "electrum path", self.path)
Exemple #43
0
 def backup( self ):
     f = open( util.user_dir( "c_{}.backup".format(self.name) ) , "wb" )
     cPickle.dump( self , f, -1 )
     f.close()
 def backup( self ):
     f = open( util.user_dir( "c_{}.backup".format(self.name) ) , "wb" )
     cPickle.dump( self , f, -1 )
     f.close()
Exemple #45
0
 def save(self):
     with open(util.user_dir("rpg_" + self.name + ".sav"), "wb") as f:
         cPickle.dump(self, f, -1)
Exemple #46
0
 def backup(self):
     with open(util.user_dir("c_{}.backup".format(self.name)), "wb") as f:
         cPickle.dump(self, f, -1)
Exemple #47
0
 def path(self):
     wdir = self.config.get('blockchain_headers_path', user_dir())
     if wdir and not os.path.exists( wdir ): os.mkdir(wdir)
     return os.path.join( wdir, 'blockchain_headers')
 def path(self):
     wdir = self.config.get('blockchain_headers_path', user_dir())
     if wdir and not os.path.exists( wdir ): os.mkdir(wdir)
     return os.path.join( wdir, 'blockchain_headers')
Exemple #49
0
 def save(self):
     with open(util.user_dir("c_{}.sav".format(self.name)), "wb") as f:
         cPickle.dump(self, f, -1)
Exemple #50
0
 def backup( self ):
     with open( util.user_dir( "c_{}.backup".format(self.name) ) , "wb" ) as f:
         cPickle.dump( self , f, -1 )
Exemple #51
0
 def save( self ):
     with open( util.user_dir( "c_{}.sav".format(self.name) ) , "wb" ) as f:
         cPickle.dump( self , f, -1 )
Exemple #52
0
 def save(self, screen=None):
     if screen:
         pygwrap.please_stand_by(screen, "Saving...")
     with open(util.user_dir("rpg_" + self.name + ".sav"), "wb") as f:
         cPickle.dump(self, f, -1)
 def save( self ):
     f = open( util.user_dir( "c_{}.sav".format(self.name) ) , "wb" )
     cPickle.dump( self , f, -1 )
     f.close()
Exemple #54
0
 def save( self ):
     f = open( util.user_dir( "c_{}.sav".format(self.name) ) , "wb" )
     cPickle.dump( self , f, -1 )
     f.close()