# Path: credits.py
# def fileVersion(program=None, year=False):
#     ver = '?'
#     ver_yr = '????'
#     if program == None:
#         check = sys.argv[0]
#     else:
#         s = program.rfind('.')
#         if s > 0 and program[s:] == '.html':
#             check = program
#         elif s < len(program) - 4:
#             check = program + sys.argv[0][sys.argv[0].rfind('.'):]
#         else:
#             check = program
#     if check[-3:] == '.py':
#         try:
#             modtime = datetime.fromtimestamp(os.path.getmtime(check))
#             ver = '3.0.%04d.%d%02d' % (modtime.year, modtime.month, modtime.day)
#             ver_yr = '%04d' % modtime.year
#         except:
#             pass
#     elif check[-5:] == '.html':
#         try:
#             modtime = datetime.fromtimestamp(os.path.getmtime(check))
#             ver = '3.0.%04d.%d%02d' % (modtime.year, modtime.month, modtime.day)
#             ver_yr = '%04d' % modtime.year
#         except:
#             pass
#     else:
#         if sys.platform == 'win32' or sys.platform == 'cygwin':
#             try:
#                 if check.find('\\') >= 0:  # if full path
#                     info = GetFileVersionInfo(check, '\\')
#                 else:
#                     info = GetFileVersionInfo(os.getcwd() + '\\' + check, '\\')
#                 ms = info['ProductVersionMS']
#               #  ls = info['FileVersionLS']
#                 ls = info['ProductVersionLS']
#                 ver = str(HIWORD(ms)) + '.' + str(LOWORD(ms)) + '.' + str(HIWORD(ls)) + '.' + str(LOWORD(ls))
#                 ver_yr = str(HIWORD(ls))
#             except:
#                 try:
#                     info = os.path.getmtime(os.getcwd() + '\\' + check)
#                     ver = '3.0.' + datetime.fromtimestamp(info).strftime('%Y.%m%d')
#                     ver_yr = datetime.fromtimestamp(info).strftime('%Y')
#                     if ver[9] == '0':
#                         ver = ver[:9] + ver[10:]
#                 except:
#                     pass
#     if year:
#         return ver_yr
#     else:
#         return ver


import datetime
import gzip
import os
import sys
import time
import displayobject
from netCDF4 import Dataset
from PyQt4 import QtCore, QtGui
from credits import fileVersion
            lon = '(Time zone calculated from MERRA data)'
        else:
            lw = int(self.zoneCombo.currentIndex() - 13) * 15 - 7.5
            le = int(self.zoneCombo.currentIndex() - 13) * 15 + 7.5
            if lw < -180:
                lw = lw + 360
            if le > 180:
                le = le - 360
            lon = '(Approx. Longitude: %s to %s)' % ('{:0.1f}'.format(lw), '{:0.1f}'.format(le))
        self.zone_lon.setText(lon)

    def zoomChanged(self, val):
        self.zoomScale.setText('(' + scale[int(val)] + ')')
        self.zoomScale.adjustSize()

    def dirChanged(self):
        for i in range(3):
            if self.dirs[i].hasFocus():
                break
        curdir = self.dirs[i].text()
        newdir = str(QtGui.QFileDialog.getExistingDirectory(self, 'Choose ' + self.dir_labels[i] + ' Folder',
                 curdir, QtGui.QFileDialog.ShowDirsOnly))
        if newdir != '':
            self.dirs[i].setText(newdir)
            if self.checkbox.isChecked():
                if i == 0:
                    self.dirs[1].setText(newdir)

    def helpClicked(self):
        dialog = displayobject.AnObject(QtGui.QDialog(), self.help,

# Path: credits.py
# def fileVersion(program=None, year=False):
#     ver = '?'
#     ver_yr = '????'
#     if program == None:
#         check = sys.argv[0]
#     else:
#         s = program.rfind('.')
#         if s > 0 and program[s:] == '.html':
#             check = program
#         elif s < len(program) - 4:
#             check = program + sys.argv[0][sys.argv[0].rfind('.'):]
#         else:
#             check = program
#     if check[-3:] == '.py':
#         try:
#             modtime = datetime.fromtimestamp(os.path.getmtime(check))
#             ver = '3.0.%04d.%d%02d' % (modtime.year, modtime.month, modtime.day)
#             ver_yr = '%04d' % modtime.year
#         except:
#             pass
#     elif check[-5:] == '.html':
#         try:
#             modtime = datetime.fromtimestamp(os.path.getmtime(check))
#             ver = '3.0.%04d.%d%02d' % (modtime.year, modtime.month, modtime.day)
#             ver_yr = '%04d' % modtime.year
#         except:
#             pass
#     else:
#         if sys.platform == 'win32' or sys.platform == 'cygwin':
#             try:
#                 if check.find('\\') >= 0:  # if full path
#                     info = GetFileVersionInfo(check, '\\')
#                 else:
#                     info = GetFileVersionInfo(os.getcwd() + '\\' + check, '\\')
#                 ms = info['ProductVersionMS']
#               #  ls = info['FileVersionLS']
#                 ls = info['ProductVersionLS']
#                 ver = str(HIWORD(ms)) + '.' + str(LOWORD(ms)) + '.' + str(HIWORD(ls)) + '.' + str(LOWORD(ls))
#                 ver_yr = str(HIWORD(ls))
#             except:
#                 try:
#                     info = os.path.getmtime(os.getcwd() + '\\' + check)
#                     ver = '3.0.' + datetime.fromtimestamp(info).strftime('%Y.%m%d')
#                     ver_yr = datetime.fromtimestamp(info).strftime('%Y')
#                     if ver[9] == '0':
#                         ver = ver[:9] + ver[10:]
#                 except:
#                     pass
#     if year:
#         return ver_yr
#     else:
#         return ver


# Path: makerainfall2.py
import datetime
import gzip
import os
import sys
import time
import displayobject
from netCDF4 import Dataset
from PyQt4 import QtCore, QtGui
from credits import fileVersion

            lon = '(Time zone calculated from MERRA data)'
        else:
            lw = int(self.zoneCombo.currentIndex() - 13) * 15 - 7.5
            le = int(self.zoneCombo.currentIndex() - 13) * 15 + 7.5
            if lw < -180:
                lw = lw + 360
            if le > 180:
                le = le - 360
            lon = '(Approx. Longitude: %s to %s)' % ('{:0.1f}'.format(lw), '{:0.1f}'.format(le))
        self.zone_lon.setText(lon)

    def zoomChanged(self, val):
        self.zoomScale.setText('(' + scale[int(val)] + ')')
        self.zoomScale.adjustSize()

    def dirChanged(self):
        for i in range(3):
            if self.dirs[i].hasFocus():
                break
        curdir = self.dirs[i].text()
        newdir = str(QtGui.QFileDialog.getExistingDirectory(self, 'Choose ' + self.dir_labels[i] + ' Folder',
                 curdir, QtGui.QFileDialog.ShowDirsOnly))
        if newdir != '':
            self.dirs[i].setText(newdir)
            if self.checkbox.isChecked():
                if i == 0:
                    self.dirs[1].setText(newdir)

    def helpClicked(self):
        dialog = displayobject.AnObject(QtGui.QDialog(), self.help,

                 title='Help for makerainfall2 (' + fileVersion() + ')', section='merrar')