Esempio n. 1
0
def _files():
    import sys
    import os
    import vcs
    dotdir, dotdirenv = vcs.getdotdirectory()
    #
    # Create .uvcdat directory if it does not exist
    try:
        fn = os.environ[dotdirenv]
    except Exception:
        try:
            fn = '%s/%s' % (os.path.expanduser("~"), dotdir)
        except Exception:
            print("Could not find the $HOME or the %s directory." % (dotdir))
            print("Set your environment variable 'HOME' or '%s'" % (dotdirenv))
            print(
                "to your home directory. (e.g., 'export HOME=/home/username')."
            )
            sys.exit()
    if os.access(fn, os.X_OK) == 0:
        try:
            os.mkdir(fn)
        except Exception:
            print(
                "Do not have write permission for user's home directory. Must have write permissions."
            )
            sys.exit()
Esempio n. 2
0
    def __init__(self, name=None, source='default', x=None, template=None):
        self.g_name = 'Guc'
        self.g_type = 'userconts'
        VCSaddon.__init__(self, name, source, x, template)
        if source == 'default':
            self.datadir = os.path.join(
                os.path.expanduser("~"),
                vcs.getdotdirectory()[0])
            self.types = [1, ]
            self.colors = [242, ]
            self.lines = ['solid', ]
            self.widths = [1, ]
            self.sources = [0, ]
        else:
            gm = vcsaddons.gms[self.g_name][source]
            self.datadir = gm.datadir
            self.types = gm.types
            self.colors = gm.colors
            self.lines = gm.lines
            self.widths = gm.widths
            self.sources = gm.sources

        try:
            import bz2
            self.HAVE_BZ2 = True
        except BaseException:
            self.HAVE_BZ2 = False
Esempio n. 3
0
def add_gplot_commands():
    import sys, os, string, vcs
    dotdir = vcs.getdotdirectory()[0]
    try:
        fn = os.path.join(os.environ['HOME'], dotdir, 'HARD_COPY')
        fn2 = os.path.join(os.environ['HOME'], dotdir, 'HARD_COPY.tmp')
    except:
        return
    try:
        f = open(fn, "r+")
        f2 = open(fn2, "w")
    except:
        return

    # Replace the Landscape command string in the file
    lp = f.tell()
    ln = f.readline()
    while (1):
        if ((ln != '\n') and ((string.split(ln)[0] == "#landscape") or
                              (string.split(ln)[0] == "landscape"))):
            break
        f2.write(ln)
        lp = f.tell()
        ln = f.readline()
    f.seek(lp)
    landscape = 'landscape = ' + os.path.join(
        vcs.__path__[0], '..', '..', '..',
        '..') + '/bin/gplot -dPSC -r90 -x-1.75 -D -X12.5 -Y10\n\n'
    f2.write(landscape)

    # Replace the Portrait command string in the file
    lp = f.tell()
    ln = f.readline()
    ln = f.readline()
    ln = f.readline()
    while (1):
        if ((ln != '\n') and ((string.split(ln)[0] == "#portrait") or
                              (string.split(ln)[0] == "portrait"))):
            break
        f2.write(ln)
        lp = f.tell()
        ln = f.readline()
    f.seek(lp)
    portrait = 'portrait = ' + os.path.join(
        vcs.__path__[0], '..', '..', '..',
        '..') + '/bin/gplot -dPSC -D -X10 -Y12.5\n\n'
    f2.write(portrait)

    ln = f.readline()
    ln = f.readline()
    ln = f.readlines()
    f2.writelines(ln)

    f.close()
    f2.close()

    # Move HARD_COPY.tmp to HARD_COPY
    command = 'mv -f %s %s' % (fn2, fn)
    os.system(command)
 def do_test(self):
     self.win.SetSize(100, 80)
     fonts = ["Arial", "Courier", os.path.join(os.environ["HOME"], vcs.getdotdirectory()[0], "HelvMono.ttf")]
     sizes = [8, 12, 16]
     for ind, font in enumerate(fonts):
         b = vcs.vtk_ui.Button(self.inter, label="Font Test", font=font, top=ind * 25, size=sizes[ind])
         b.show()
     self.test_file = "test_vtk_ui_button_font.png"
Esempio n. 5
0
def _files():
    import sys
    import os
    import shutil
    import vcs
    dotdir, dotdirenv = vcs.getdotdirectory()
    #
    # Create .uvcdat directory if it does not exist
    try:
        fn = os.environ[dotdirenv]
    except:
        try:
            fn = '%s/%s' % (os.path.expanduser("~"), dotdir)
        except:
            print "Could not find the $HOME directory or the %s."
            print "Set your environment variable 'HOME' or '%s'" % (dotdir, dotdirenv)
            print "to your home directory. (e.g., 'setenv HOME /home/user')."
            sys.exit()
    if os.access(fn, os.X_OK) == 0:
        try:
            os.mkdir(fn)
        except:
            print "Do not have write permission for user's home directory. Must have write permissions."
            sys.exit()
    #
    # Copy the initial.attributes file to the user's $HOME/.uvcdat directory
    files = ["initial.attributes",
             "data_continent_states",
             "data_continent_political",
             "data_continent_river",
             "data_continent_other7",
             ]
    for file_name in files:
        file_cp = os.path.join(
            vcs.prefix,
            'share',
            'vcs',
            file_name)
        ofile = os.path.join(fn, file_name)
        if (os.access(file_cp, os.F_OK) == 1) and (
                os.path.isfile(ofile) == 0):
            shutil.copyfile(file_cp, ofile)

    # Copy font files to the user's $HOME/.uvcdat
    for font in ['Adelon_Regular', 'Arabic', 'Athens_Greek', 'AvantGarde-Book_Bold',
                 'Chinese_Generic1', 'Clarendon', 'Courier', 'hebrew', 'HelvMono',
                 'Russian', 'Times_CG_ATT', 'jsMath-wasy10', 'blex', 'blsy', 'jsMath-msam10']:
        fnm_cp = os.path.join(
            vcs.prefix,
            'share',
            'vcs',
            font +
            '.ttf')
        fnm = os.path.join(fn, font + '.ttf')
        if (os.access(fnm_cp, os.F_OK) == 1) and (os.path.isfile(fnm) == 0):
            shutil.copyfile(fnm_cp, fnm)
Esempio n. 6
0
def saveinitialattributes():
    _dotdir,_dotdirenv = vcs.getdotdirectory()
    fnm = os.path.join(os.environ['HOME'], _dotdir, 'initial.attributes')
    if os.path.exists(fnm):
      os.remove(fnm)
    for k,e in vcs.elements.iteritems():
      if k in ["font","fontNumber","list"]:
        continue
      for nm,g in e.iteritems():
        if nm!="default":
          g.script(fnm)
Esempio n. 7
0
def add_gplot_commands( ):
   import sys, os, string, vcs
   dotdir = vcs.getdotdirectory()[0]
   try:
      fn = os.path.join(os.environ['HOME'], dotdir, 'HARD_COPY')
      fn2 = os.path.join(os.environ['HOME'], dotdir, 'HARD_COPY.tmp')
   except:
      return
   try:
      f=open( fn, "r+" )
      f2=open( fn2, "w" )
   except:
      return

   # Replace the Landscape command string in the file
   lp = f.tell()
   ln = f.readline()
   while (1):
      if ( (ln != '\n') and ((string.split( ln )[0] == "#landscape") or 
         (string.split( ln )[0] == "landscape")) ): break
      f2.write( ln ) 
      lp = f.tell()
      ln = f.readline()
   f.seek( lp )
   landscape = 'landscape = ' + os.path.join(vcs.__path__[0],'..','..','..','..') + '/bin/gplot -dPSC -r90 -x-1.75 -D -X12.5 -Y10\n\n'
   f2.write( landscape ) 

   # Replace the Portrait command string in the file
   lp = f.tell()
   ln = f.readline()
   ln = f.readline()
   ln = f.readline()
   while (1):
      if ( (ln != '\n') and ((string.split( ln )[0] == "#portrait") or 
         (string.split( ln )[0] == "portrait")) ): break
      f2.write( ln ) 
      lp = f.tell()
      ln = f.readline()
   f.seek( lp )
   portrait = 'portrait = ' + os.path.join(vcs.__path__[0],'..','..','..','..') + '/bin/gplot -dPSC -D -X10 -Y12.5\n\n'
   f2.write( portrait ) 

   ln = f.readline()
   ln = f.readline()
   ln = f.readlines()
   f2.writelines( ln )

   f.close( )
   f2.close( )

   # Move HARD_COPY.tmp to HARD_COPY
   command = 'mv -f %s %s' % (fn2, fn)
   os.system( command ) 
Esempio n. 8
0
def add_printer(printer_name):
    import os
    plist = []
    dotdir = vcs.getdotdirectory()[0]
    try:
        fn = '%s/%s/HARD_COPY' % (os.environ['HOME'], dotdir)
    except:
        return plist
    try:
        f = open(fn, "a")
    except:
        return
    f.write("\n")
    f.write(printer_name)
    f.write("\n")
    f.close()
Esempio n. 9
0
def add_printer(printer_name):
    import os
    plist = []
    dotdir = vcs.getdotdirectory()[0]
    try:
        fn = '%s/%s/HARD_COPY' % (os.environ['HOME'], dotdir)
    except:
        return plist
    try:
        f = open(fn, "a")
    except:
        return
    f.write("\n")
    f.write(printer_name)
    f.write("\n")
    f.close()
Esempio n. 10
0
 def do_test(self):
     self.win.SetSize(100, 80)
     fonts = [
         "Arial", "Courier",
         os.path.join(os.environ["HOME"],
                      vcs.getdotdirectory()[0], "HelvMono.ttf")
     ]
     sizes = [8, 12, 16]
     for ind, font in enumerate(fonts):
         b = vcs.vtk_ui.Button(self.inter,
                               label="Font Test",
                               font=font,
                               top=ind * 25,
                               size=sizes[ind])
         b.show()
     self.test_file = "test_vtk_ui_button_font.png"
Esempio n. 11
0
def remove_printer(printer_name):
    import os, string, vcs
    plist = []
    dotdir = vcs.getdotdirectory()[0]
    try:
        fn = '%s/%s/HARD_COPY' % (os.environ['HOME'], dotdir)
    except:
        return plist
    try:
        f = open(fn, "r+")
    except:
        return
    lp = f.tell()
    ln = f.readline()
    while string.strip(ln) != printer_name and ln != '':
        lp = f.tell()
        ln = f.readline()
    f.seek(lp - 1)
    f.write(' ' * len(ln))
    f.close()
Esempio n. 12
0
def remove_printer( printer_name ):
   import os, string,vcs
   plist = []
   dotdir = vcs.getdotdirectory()[0]
   try:
      fn = '%s/%s/HARD_COPY' % (os.environ['HOME'],dotdir)
   except:
      return plist
   try:
      f=open( fn, "r+" )
   except:
      return
   lp = f.tell()
   ln = f.readline()
   while string.strip(ln) != printer_name and ln != '':
      lp = f.tell()
      ln = f.readline()
   f.seek( lp-1 )
   f.write ( ' '*len(ln) )
   f.close( )
Esempio n. 13
0
def list_printers( ):
   import os,vcs
   dotdir = vcs.getdotdirectory()[0]
   plist = []
   try:
      fn = '%s/%s/HARD_COPY' % (os.environ['HOME'],dotdir)
   except:
      return plist
   try:
      f=open( fn )
   except:
      return plist
   ln = f.readline()
   while ln:
      if ln[0] != '#':
         if (ln[0:9] == 'landscape' or ln[0:8] == 'portrait' or
            ln[0] == ' ' or ln[0] == '\n'):
            pass
         else:
            plist.append(ln[0:-1])
      ln = f.readline()
   f.close( )
   return plist
Esempio n. 14
0
def list_printers():
    import os, vcs
    dotdir = vcs.getdotdirectory()[0]
    plist = []
    try:
        fn = '%s/%s/HARD_COPY' % (os.environ['HOME'], dotdir)
    except:
        return plist
    try:
        f = open(fn)
    except:
        return plist
    ln = f.readline()
    while ln:
        if ln[0] != '#':
            if (ln[0:9] == 'landscape' or ln[0:8] == 'portrait' or ln[0] == ' '
                    or ln[0] == '\n'):
                pass
            else:
                plist.append(ln[0:-1])
        ln = f.readline()
    f.close()
    return plist
Esempio n. 15
0
def _files():
    import sys
    import os
    import shutil
    import vcs
    dotdir, dotdirenv = vcs.getdotdirectory()
    #
    # Create .uvcdat directory if it does not exist
    try:
        fn = os.environ[dotdirenv]
    except:
        try:
            fn = '%s/%s' % (os.environ['HOME'], dotdir)
        except:
            print "Could not find the $HOME directory or the %s."
            print "Set your environment variable 'HOME' or '%s'" % (dotdir,
                                                                    dotdirenv)
            print "to your home directory. (e.g., 'setenv HOME /home/user')."
            sys.exit()
    if os.access(fn, os.X_OK) == 0:
        try:
            os.mkdir(fn)
        except:
            print "Do not have write permission for user's home directory. Must have write permissions."
            sys.exit()
    #
    # Copy the initial.attributes file to the user's $HOME/.uvcdat directory
    init_file_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..', 'bin',
                                'initial.attributes')
    init_file = os.path.join(fn, 'initial.attributes')
    if (os.access(init_file_cp, os.F_OK) == 1) and (os.path.isfile(init_file)
                                                    == 0):
        shutil.copyfile(init_file_cp, init_file)

    # Copy the  icon file to the user's $HOME/.uvcdat directory
    icon_file_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..', 'bin',
                                'vcs_icon.xbm')
    icon_file = os.path.join(fn, 'vcs_icon.xbm')
    # if (os.access(icon_file_cp, os.F_OK) == 1)  and
    # (os.path.isfile(icon_file) == 0):
    if (os.access(icon_file_cp, os.F_OK) == 1):

        shutil.copyfile(icon_file_cp, icon_file)
    #
    # Copy the HARD_COPY file to the user's $HOME/.uvcdat directory
    hard_copy_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..', 'bin',
                                'HARD_COPY')
    hard_copy = os.path.join(fn, 'HARD_COPY')
    if (os.access(hard_copy_cp, os.F_OK) == 1) and (os.path.isfile(hard_copy)
                                                    == 0):
        shutil.copyfile(hard_copy_cp, hard_copy)
        # Add the gplot commands to the HARD_COPY file
        add_gplot_commands()

    #
    # Copy the data_continent_states file to the user's $HOME/.uvcdat directory
    cont_states_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..',
                                  'bin', 'data_continent_states')
    cont_states = os.path.join(fn, 'data_continent_states')
    if (os.access(cont_states_cp, os.F_OK)
            == 1) and (os.path.isfile(cont_states) == 0):
        shutil.copyfile(cont_states_cp, cont_states)
    #
    # Copy the data_continent_political file to the user's $HOME/.uvcdat
    # directory
    cont_political_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..',
                                     'bin', 'data_continent_political')
    cont_political = os.path.join(fn, 'data_continent_political')
    if (os.access(cont_political_cp, os.F_OK)
            == 1) and (os.path.isfile(cont_political) == 0):
        shutil.copyfile(cont_political_cp, cont_political)
    #
    # Copy the data_continent_river file to the user's $HOME/.uvcdat directory
    cont_river_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..',
                                 'bin', 'data_continent_river')
    cont_river = os.path.join(fn, 'data_continent_river')
    if (os.access(cont_river_cp, os.F_OK) == 1) and (os.path.isfile(cont_river)
                                                     == 0):
        shutil.copyfile(cont_river_cp, cont_river)
    #
    # Copy the data_continent_other7 file to the user's $HOME/.uvcdat directory
    cont_other7_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..',
                                  'bin', 'data_continent_other7')
    cont_other7 = os.path.join(fn, 'data_continent_other7')
    if (os.access(cont_other7_cp, os.F_OK)
            == 1) and (os.path.isfile(cont_other7) == 0):
        shutil.copyfile(cont_other7_cp, cont_other7)

    # Copy font files to the user's $HOME/.uvcdat
    for font in [
            'Adelon_Regular', 'Arabic', 'Athens_Greek', 'AvantGarde-Book_Bold',
            'Chinese_Generic1', 'Clarendon', 'Courier', 'hebrew', 'HelvMono',
            'Russian', 'Times_CG_ATT', 'jsMath-wasy10', 'blex', 'blsy',
            'jsMath-msam10'
    ]:
        fnm_cp = os.path.join(vcs.__path__[0], '..', '..', '..', '..', 'bin',
                              font + '.ttf')
        fnm = os.path.join(fn, font + '.ttf')
        if (os.access(fnm_cp, os.F_OK) == 1) and (os.path.isfile(fnm) == 0):
            shutil.copyfile(fnm_cp, fnm)
Esempio n. 16
0

for i in range(12):
    cont_index = i % 6 + 1
    cont_line = vcs.createline()
    cont_line.width = i % 3 + 1
    cont_line.type = line_styles[i % 5]
    print "Cont_line_rtype:",line_styles[i % 5]
    cont_line.color = i + 200
    template = multitemplate.get(i)
    if cont_index != 3 and i != 4 and i != 11:
        canvas.plot(clt, template, boxfill, continents=cont_index, continents_line=cont_line, bg=1)
    elif cont_index == 3:
        canvas.setcontinentsline(cont_line)
        canvas.setcontinentstype(3)
        canvas.plot(clt, template, boxfill, bg=1)
    elif i == 4:
        canvas.setcontinentstype(0)
        # Make sure absolute path works
        path = os.path.join(vcs.prefix, "share", "vcs", "data_continent_political")
        canvas.plot(clt, template, boxfill, continents=path, continents_line=cont_line, bg=1)
    elif i == 11:
        # Make sure the dotdirectory other* works
        dotdir = vcs.getdotdirectory()
        current_dotdir = os.environ.get(dotdir[1], dotdir[0])
        os.environ["UVCDAT_DIR"] = os.path.join(vcs.prefix, "share", "vcs")
        # Should pick up the other7 continents
        canvas.plot(clt, template, boxfill, continents=7, continents_line=cont_line, bg=1)
        os.environ["UVCDAT_DIR"] = current_dotdir

regression.run(canvas, "test_continents.png")
Esempio n. 17
0
    def testContinents(self):

        # Load the clt data:
        clt = self.clt("clt", time="1979-1-1", squeeze=1)

        # Zero out the array so we can see the continents clearly
        clt[:] = 0

        # Create and plot quick boxfill with default settings:
        boxfill = self.x.createboxfill()
        # Change the type
        boxfill.boxfill_type = 'custom'
        # Set levels to ignore 0
        boxfill.levels = [1, 100]
        # Pick a color, any color
        boxfill.fillareacolors = [242]

        dataonly = self.x.createtemplate()
        dataonly.blank()
        dataonly.data.priority = 1

        line_styles = ['long-dash', 'dot', 'dash', 'dash-dot', 'solid']

        self.x.scriptrun(
            os.path.join(
                os.path.dirname(__file__),
                "share",
                "test_vcs_continents.json"))

        for i in range(12):
            cont_index = i % 6 + 1
            cont_line = self.x.createline()
            cont_line.width = i % 3 + 1
            cont_line.type = line_styles[i % 5]
            cont_line.color = i + 200
            col = i % 3
            row = i / 3
            template = self.x.gettemplate("%i_x_%i_1" % (col, row))
            if cont_index != 3 and i != 4 and i != 11:
                self.x.plot(
                    clt,
                    template,
                    boxfill,
                    continents=cont_index,
                    continents_line=cont_line,
                    bg=self.bg)
            elif cont_index == 3:
                self.x.setcontinentsline(cont_line)
                self.x.plot(clt, template, boxfill, continents=3, bg=self.bg)
            elif i == 4:
                # Make sure absolute path works
                path = os.path.join(
                    vcs.vcs_egg_path, "data_continent_political")
                self.x.plot(
                    clt,
                    template,
                    boxfill,
                    continents=path,
                    continents_line=cont_line,
                    bg=self.bg)
            elif i == 11:
                # Make sure the dotdirectory other* works
                dotdir = vcs.getdotdirectory()
                current_dotdir = os.environ.get(dotdir[1], dotdir[0])
                os.environ["UVCDAT_DIR"] = vcs.vcs_egg_path
                # Should pick up the other7 continents
                self.x.plot(
                    clt,
                    template,
                    boxfill,
                    continents=7,
                    continents_line=cont_line,
                    bg=self.bg)
                os.environ["UVCDAT_DIR"] = current_dotdir

        self.checkImage("test_vcs_continents.png", threshold=12)
Esempio n. 18
0
    def testContinents(self):

        # Load the clt data:
        clt = self.clt("clt", time="1979-1-1", squeeze=1)

        # Zero out the array so we can see the continents clearly
        clt[:] = 0

        # Create and plot quick boxfill with default settings:
        boxfill = self.x.createboxfill()
        # Change the type
        boxfill.boxfill_type = 'custom'
        # Set levels to ignore 0
        boxfill.levels = [1, 100]
        # Pick a color, any color
        boxfill.fillareacolors = [242]

        dataonly = self.x.createtemplate()
        dataonly.blank()
        dataonly.data.priority = 1

        multitemplate = EzTemplate.Multi(template=dataonly, rows=4, columns=3)

        line_styles = ['long-dash', 'dot', 'dash', 'dash-dot', 'solid']

        for i in range(12):
            cont_index = i % 6 + 1
            cont_line = self.x.createline()
            cont_line.width = i % 3 + 1
            cont_line.type = line_styles[i % 5]
            print "Cont_line_rtype:", line_styles[i % 5]
            cont_line.color = i + 200
            template = multitemplate.get(i)
            if cont_index != 3 and i != 4 and i != 11:
                self.x.plot(clt,
                            template,
                            boxfill,
                            continents=cont_index,
                            continents_line=cont_line,
                            bg=self.bg)
            elif cont_index == 3:
                self.x.setcontinentsline(cont_line)
                self.x.setcontinentstype(3)
                self.x.plot(clt, template, boxfill, bg=self.bg)
            elif i == 4:
                self.x.setcontinentstype(0)
                # Make sure absolute path works
                path = os.path.join(vcs.prefix, "share", "vcs",
                                    "data_continent_political")
                self.x.plot(clt,
                            template,
                            boxfill,
                            continents=path,
                            continents_line=cont_line,
                            bg=self.bg)
            elif i == 11:
                # Make sure the dotdirectory other* works
                dotdir = vcs.getdotdirectory()
                current_dotdir = os.environ.get(dotdir[1], dotdir[0])
                os.environ["UVCDAT_DIR"] = os.path.join(
                    vcs.prefix, "share", "vcs")
                # Should pick up the other7 continents
                self.x.plot(clt,
                            template,
                            boxfill,
                            continents=7,
                            continents_line=cont_line,
                            bg=self.bg)
                os.environ["UVCDAT_DIR"] = current_dotdir

        self.checkImage("test_vcs_continents.png", threshold=12)
Esempio n. 19
0
def _files():
    import sys
    import os
    import shutil
    import vcs
    dotdir, dotdirenv = vcs.getdotdirectory()
    #
    # Create .uvcdat directory if it does not exist
    try:
        fn = os.environ[dotdirenv]
    except:
        try:
            fn = '%s/%s' % (os.environ['HOME'], dotdir)
        except:
            print "Could not find the $HOME directory or the %s."
            print "Set your environment variable 'HOME' or '%s'" % (dotdir, dotdirenv)
            print "to your home directory. (e.g., 'setenv HOME /home/user')."
            sys.exit()
    if os.access(fn, os.X_OK) == 0:
        try:
            os.mkdir(fn)
        except:
            print "Do not have write permission for user's home directory. Must have write permissions."
            sys.exit()
    #
    # Copy the initial.attributes file to the user's $HOME/.uvcdat directory
    init_file_cp = os.path.join(
        vcs.__path__[0],
        '..',
        '..',
        '..',
        '..',
        'bin',
        'initial.attributes')
    init_file = os.path.join(fn, 'initial.attributes')
    if (os.access(init_file_cp, os.F_OK) == 1) and (
            os.path.isfile(init_file) == 0):
        shutil.copyfile(init_file_cp, init_file)

    # Copy the  icon file to the user's $HOME/.uvcdat directory
    icon_file_cp = os.path.join(
        vcs.__path__[0],
        '..',
        '..',
        '..',
        '..',
        'bin',
        'vcs_icon.xbm')
    icon_file = os.path.join(fn, 'vcs_icon.xbm')
# if (os.access(icon_file_cp, os.F_OK) == 1)  and
# (os.path.isfile(icon_file) == 0):
    if (os.access(icon_file_cp, os.F_OK) == 1):

        shutil.copyfile(icon_file_cp, icon_file)
    #
    # Copy the HARD_COPY file to the user's $HOME/.uvcdat directory
    hard_copy_cp = os.path.join(
        vcs.__path__[0],
        '..',
        '..',
        '..',
        '..',
        'bin',
        'HARD_COPY')
    hard_copy = os.path.join(fn, 'HARD_COPY')
    if (os.access(hard_copy_cp, os.F_OK) == 1) and (
            os.path.isfile(hard_copy) == 0):
        shutil.copyfile(hard_copy_cp, hard_copy)
        # Add the gplot commands to the HARD_COPY file
        add_gplot_commands()

    #
    # Copy the data_continent_states file to the user's $HOME/.uvcdat directory
    cont_states_cp = os.path.join(
        vcs.__path__[0],
        '..',
        '..',
        '..',
        '..',
        'bin',
        'data_continent_states')
    cont_states = os.path.join(fn, 'data_continent_states')
    if (os.access(cont_states_cp, os.F_OK) == 1) and (
            os.path.isfile(cont_states) == 0):
        shutil.copyfile(cont_states_cp, cont_states)
    #
    # Copy the data_continent_political file to the user's $HOME/.uvcdat
    # directory
    cont_political_cp = os.path.join(
        vcs.__path__[0],
        '..',
        '..',
        '..',
        '..',
        'bin',
        'data_continent_political')
    cont_political = os.path.join(fn, 'data_continent_political')
    if (os.access(cont_political_cp, os.F_OK) == 1) and (
            os.path.isfile(cont_political) == 0):
        shutil.copyfile(cont_political_cp, cont_political)
    #
    # Copy the data_continent_river file to the user's $HOME/.uvcdat directory
    cont_river_cp = os.path.join(
        vcs.__path__[0],
        '..',
        '..',
        '..',
        '..',
        'bin',
        'data_continent_river')
    cont_river = os.path.join(fn, 'data_continent_river')
    if (os.access(cont_river_cp, os.F_OK) == 1) and (
            os.path.isfile(cont_river) == 0):
        shutil.copyfile(cont_river_cp, cont_river)
    #
    # Copy the data_continent_other7 file to the user's $HOME/.uvcdat directory
    cont_other7_cp = os.path.join(
        vcs.__path__[0],
        '..',
        '..',
        '..',
        '..',
        'bin',
        'data_continent_other7')
    cont_other7 = os.path.join(fn, 'data_continent_other7')
    if (os.access(cont_other7_cp, os.F_OK) == 1) and (
            os.path.isfile(cont_other7) == 0):
        shutil.copyfile(cont_other7_cp, cont_other7)

    # Copy font files to the user's $HOME/.uvcdat
    for font in ['Adelon_Regular', 'Arabic', 'Athens_Greek', 'AvantGarde-Book_Bold',
                 'Chinese_Generic1', 'Clarendon', 'Courier', 'hebrew', 'HelvMono',
                 'Russian', 'Times_CG_ATT', 'jsMath-wasy10', 'blex', 'blsy', 'jsMath-msam10']:
        fnm_cp = os.path.join(
            vcs.__path__[0],
            '..',
            '..',
            '..',
            '..',
            'bin',
            font +
            '.ttf')
        fnm = os.path.join(fn, font + '.ttf')
        if (os.access(fnm_cp, os.F_OK) == 1) and (os.path.isfile(fnm) == 0):
            shutil.copyfile(fnm_cp, fnm)