Пример #1
0
def dowloadDocu(configfile, filename, storagePath):
    """
    :param configfile:
    :param filename:
    :param dDate:
    :param storagePath:
    :return:
    """
    configData = getConfigData(configfile, boolCrypt=False)
    serverdata = configData[0]

    splittedURL = serverdata.url.split('/')
    serverURL = splittedURL[0]
    for split in splittedURL[1:-2]:
        serverURL = serverURL + '/' + split
    serverURL = serverURL + '/documentation/'
    serverdata.url = serverURL

    filename = filename.replace(' ', '%20') # replace whitespace with %20

    ret = dailyList.download_daily(serverdata, storagePath, filename) # -> jump module
    if ret == 2:
        os.remove(storagePath + '/download/' + filename)

    return ret # just return if it was successfull or user terminated download etc.
Пример #2
0
    def run(self):
        while self.running:
            dailyDate = processDailyDate(self.configfile, 'read')
            serverdata, storagePath = getConfigData(self.configfile)
            daily_list = get_daily_flist(dailyDate.date)
            new_versions = []
            message = ''

            if daily_list is not None:
                for item in daily_list:
                    if item not in self.daily_compare:
                        self.new_daily = True
                        message = message + '\n' + item
                        new_versions.append(item)

                if self.new_daily:
                    if self.TI is not None:
                        self.TI.ShowBalloon('NEW DAILY VERSION(S)', message)
                        self.TI.set_icon('dat/images/new.ico')
                        self.TI.inject_new_version(new_versions)
                    else:
                        print 'New daily version(s) available'

                    self.refresh_daily_list(daily_list)
                    self.new_daily = False


            time.sleep(self.time_interval)
Пример #3
0
def globalvarconfig(var='configfile'):
    """all global vars are listed here and can be taken from other functions"""
    global configfile
    if var == 'configfile': #default
        configfile = 'dat\config.ini'
        return configfile
    elif var == 'serverdata':
        global serverdata
        configData = getConfigData(configfile) #get all information to server and user. its encrypted and takes some time to decrypt. So we provide the information decrypted in running process.
        serverdata = configData[0]
        return serverdata
    elif var == 'images':
        global imagepaths
        imagepaths = 'dat\\images\\'
        return imagepaths
Пример #4
0
def getFirstAvailableDailyDate():
    from utility.configurator import getConfigData
    from utility.configurator import globalvarconfig

    try:
        configData = getConfigData(globalvarconfig(), boolCrypt=True)
        serverdata = configData[0]

        passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
        passman.add_password(None, serverdata.url, serverdata.user, serverdata.passw)
        urllib2.install_opener(urllib2.build_opener(urllib2.HTTPBasicAuthHandler(passman)))

        req = urllib2.Request(serverdata.url)
        try:
            f = urllib2.urlopen(req)
            data = f.read()
        except:
            pass

        firstAvailDate = []
        for i in range(len(data)):
            if data[i:i+4].find('href') is not -1:
                firstAvailDate.append(data[i+6:i+16])

        # proof if we read valid date format
        while 1:
            for i in range(len(firstAvailDate)):
                try:
                    int(firstAvailDate[i][0:4])  # if conversion fails str isn't a number in char
                except:
                    del firstAvailDate[i]  # kill entry
                    break
            if i >= len(firstAvailDate)-1:
                break
    except:
        firstAvailDate = None

    return firstAvailDate[-1]  # return last element. This is the oldest available daily
Пример #5
0
def dowloadDaily(configfile, filename, dDate, storagePath):
    """
    :param configfile:
    :param filename:
    :param dDate:
    :param storagePath:
    :return:
    """
    configData = getConfigData(configfile, boolCrypt=False)
    serverdata = configData[0]

    try:
        dailyDate = dDate.date
    except:
        dailyDate = dDate

    serverdata.url = dailyList.assemble_daily_url(serverdata.url, dailyDate)

    ret = dailyList.download_daily(serverdata, storagePath, filename) # -> jump module
    if ret == 2:
        os.remove(storagePath + '/download/' + filename)

    return ret # just return if it was successfull or user terminated download etc.
Пример #6
0
    def CreatePopupMenu(self):
        from UI.SearchRevision.datemanager import extractDateFromDFName
        from utility.dmanager import dmanaging
        from utility import iconiser

        # define global vars at the beginning of definition. Avoid warnings
        global dailylinklist
        global rhinolinklist
        global menu
        global dailysubmenus
        global docsubmenu

        if self.UPDATE_AVAILABLE:
            TI.set_icon('dat/images/theme_02/update_process/update_0.ico')
        else:
            # reset icon to original
            TI.set_icon('dat/images/icon.ico')

        configData = getConfigData(configfile, boolCrypt=False)

        storagePath = configData[1].extracted
        storagePath = storagePath.replace('\\', '/')

        dailyDate = processDailyDate(configfile, 'read')

        dailylinklist = dailyList.get_daily_flist(dailyDate.date) #-> jump module getting daily list

        DM = dmanaging()
        dailylinklist_menu = DM.format_daily_date(dailylinklist)

        time_list = []
        if dailylinklist_menu is not None:
            for item in dailylinklist_menu:
                time_list.append(item[:8])

        time_list_sorted = sorted(time_list)
        dailylinklist_tmp = copy.deepcopy(dailylinklist)
        # sort daily list
        for i, elem in enumerate(time_list_sorted):
            pos = [ii for ii, s in enumerate(dailylinklist_menu) if elem in s]
            dailylinklist[i] = dailylinklist_tmp[pos[0]]

        if dailylinklist is not None:
            dailylinklist.reverse()

        olddailylinklist = dailyList.get_old_daily_flist(storagePath, dailylinklist) #-> jump module getting old daily list
        rhinolinklist = dailyList.get_rhino_daily_flist('tools\MWRhinoplugin') #-> jump module getting old daily list
        machineslinklist = dailyList.get_rhino_daily_flist('tools\Machines') #-> jump module getting old daily list
        doculinklist = dailyList.get_docu_flist() #-> jump module getting docu list

        menu = wx.Menu()
        dailysubmenus = []
        docsubmenu = {}

        # TODO analyse the build of createPopupMenu. Its to complicated

        # startValue = 500
        j = 0
        jr = 0 # only for rhino submenu
        jj = 0
        for i in reversed(menustruct.main):
            # ********* SUBMENUS **********
            if i[-2] == "SUB":
                submenu = eval('menustruct.' + i[-1])  # taken from menuconfig.py
                exec (i[-1] + ' = wx.Menu()')  # create main menu instance

                # ********* VARIABLE MENUS WITH DYNAMIC CONTENT**********
                if submenu[0][-2] == "VAR":
                    startValue = int(submenu[0][0])
                    if eval(submenu[0][-1]) is not None:# eval command represents the var dailylinklist, olddailylinklist etc.

                            for iii, counter in zip(eval(submenu[0][-1]), range(len(eval(submenu[0][-1])))):  # this is iteration through dailylinklist etc. (menuconfig.py)
                                if submenu[0][1] == "MW Plugins":
                                    if rhinolinklist[counter] == 'MWUploader.exe':
                                        create_menu_item(eval(i[-1]), iii, self.on_click, startValue + jr, icon='dat/images/theme_02/upload.ico')
                                    elif rhinolinklist[counter].find('PluginInstaller') != -1:
                                        create_menu_item(eval(i[-1]), iii, self.on_click, startValue + jr, icon='dat/images/theme_02/rhino.ico')
                                    else:
                                        create_menu_item(eval(i[-1]), iii, self.on_click, startValue + jr) # build up plugin submenu , icon=i[2][5:]
                                    jr += 1
                                else:
                                    # create submenu for dynamic menus version with its executables
                                    if os.path.exists(storagePath + '/daily/' + iii):

                                        # create menu instance
                                        exemenu = wx.Menu()

                                        startdailysubIDs = startValue + j * 50
                                        dailysubmenus.append([iii, startdailysubIDs])

                                        if iii[-4:] == '.zip':
                                            iii_tmp = iii
                                            iii = DM.get_daily_date_str(iii)
                                        else:
                                            iii_tmp = iii

                                        # append submenu of daily version with executables
                                        dailysubIDs = startdailysubIDs
                                        exelist = []

                                        # switch back to unformatted daily date - original file name
                                        iii = iii_tmp

                                        # go through all submenus
                                        path = (storagePath + '/daily/' + iii)

                                        # switch back to formatted daily string
                                        if iii.find('Quickstart') != -1:
                                            iii = DM.get_daily_date_str(iii)

                                        # create exe elements for submenu
                                        for root, dirs, files in os.walk(path):
                                            for name in files:
                                                if name.endswith((".exe")):
                                                    root = string.replace(root, '\\', '/')
                                                    if name == 'sampleintegration.exe':
                                                        create_menu_item(exemenu, name[:-4], self.on_click, dailysubIDs,
                                                                         icon='dat/images/icon.ico')

                                                    else:
                                                        create_menu_item(exemenu, name[:-4], self.on_click, dailysubIDs)

                                                    exelist.append(root + '/' + name)
                                                    dailysubIDs += 1

                                        exemenu.AppendSeparator()

                                        exelist.append('Copy daily URL to clipboard')
                                        create_menu_item(exemenu, exelist[-1], self.on_click, dailysubIDs,
                                                         icon='dat/images/theme_02/clipboard.ico')

                                        # dailysubIDs += 1 # increase for delete

                                        exelist.append('Delete daily')
                                        create_menu_item(exemenu, exelist[-1], self.on_click, dailysubIDs,
                                                         icon='dat/images/theme_02/delete.ico') # append delete selection


                                        # create parent element
                                        if iii.find('-SP') != -1:
                                            create_menu_item(eval(i[-1]), iii, self.on_click, dailysubIDs,
                                                             icon='dat/images/service_pack.ico', submenu=exemenu)
                                        elif iii.find('dev') != -1:
                                            create_menu_item(eval(i[-1]), iii, self.on_click, j,
                                                             icon='dat/images/daily_version.ico', submenu=exemenu)
                                        #elif iii.find('.chm') != -1:
                                        #    create_menu_item(eval(i[-1]), iii, self.on_click, j,
                                        #                     icon='dat/images/theme_02/documentation.ico', submenu=exemenu)
                                        else:
                                            create_menu_item(eval(i[-1]), iii, self.on_click, j,
                                                             icon='dat/images/theme_02/user.ico', submenu=exemenu)

                                        dailysubmenus.insert(len(dailysubmenus), exelist) # append exe list to daily list to be able to sort ids to exe names

                                    else:
                                        if iii[-4:] == '.zip':
                                            if iii in self.new_version:
                                                iii = DM.get_daily_date_str(iii)
                                                create_menu_item(eval(i[-1]), iii, self.on_click, j,
                                                                 icon='dat/images/new.ico')
                                            else:
                                                if iii.find('-SP') != -1:
                                                    iii = DM.get_daily_date_str(iii)
                                                    create_menu_item(eval(i[-1]), iii, self.on_click, j,
                                                                     icon='dat/images/service_pack.ico')
                                                elif iii.find('dev') != -1:
                                                    iii = DM.get_daily_date_str(iii)
                                                    create_menu_item(eval(i[-1]), iii, self.on_click, j,
                                                                     icon='dat/images/daily_version.ico')
                                        else:
                                            if i[1].find('Documentation') != -1:
                                                docsubmenu[j] = iii
                                                if os.path.isfile(storagePath + '/download/' + iii.replace('%20', ' ')):
                                                    create_menu_item(eval(i[-1]), iii, self.on_click, int(submenu[0][0]) + j,
                                                                     icon='dat/images/theme_02/download.ico')
                                                else:
                                                    create_menu_item(eval(i[-1]), iii, self.on_click, int(submenu[0][0]) + j,
                                                                     icon='dat/images/theme_02/documentation.ico')
                                            else:
                                                create_menu_item(eval(i[-1]), iii, self.on_click, j)

                                    j += 1

                    else:
                        pass
                        # print eval(i[-1])
                        # menu.AppendSubMenu(eval(i[-1]), i[1])
                        # menu.Enable(10005, False)
                        # eval('menu.' + i[-1] + '.Enable(False)')
                        # TODO when dailylinklist is empty (None) what means that connection to server failed disable the daily menu

                else:
                    for ii in range(len(submenu)):
                        if submenu[ii][-2] == "Check":
                            if submenu[ii][-1] == 'True':
                                checked = 1
                            else:
                                checked = 0
                            eval(i[-1] + '.AppendCheckItem( int(submenu[ii][0]), submenu[ii][1] )' )  # self, id, text, help)
                            eval(i[-1] + '.Check( int(submenu[ii][0]), bool(checked) )' )

                # Append menus with subelements
                if jj == 0:
                    if dailyDate.date == None:
                        create_menu_item(menu, i[1] + ' (today)', self.on_click, int(i[0]), icon=i[2][5:], submenu=eval(i[-1]))
                    else:
                        create_menu_item(menu, i[1], self.on_click, int(i[0]), icon=i[2][5:], submenu=eval(i[-1]))
                else:
                    if i[1].find('download') != -1:
                        eval(i[-1] + '.AppendSeparator()')
                        create_menu_item(eval(i[-1]), 'Open storage folder', self.on_click, int(16000), icon='dat/images/theme_02/folder.ico')  # append open folder selection
                        create_menu_item(eval(i[-1]), 'Empty storage folder', self.on_click, int(15000), icon='dat/images/theme_02/delete.ico')
                        create_menu_item(menu, i[1], self.on_click, int(i[0]), icon=i[2][5:], submenu=eval(i[-1]))
                    else:
                        create_menu_item(menu, i[1], self.on_click, int(i[0]), icon=i[2][5:], submenu=eval(i[-1]))


                jj += 1

            # Just append Seperator
            elif i[-1] == "SEPARATOR":
                menu.AppendSeparator()

            # This is the root section without submenus
            else:
                # we have to proof if an update is available
                if i[1].find('UPDATE') != -1:
                    if UPDATE_AVAILABLE:
                        if i[2][:4] == 'icon':
                            create_menu_item(menu, i[1], self.on_click, int(i[0]), icon=i[2][5:])  # menu without submenu
                        else:
                            create_menu_item(menu, i[1], self.on_click, int(i[0]))  # menu without submenu

                else:
                    if i[2][:4] == 'icon':
                        create_menu_item(menu, i[1], self.on_click, int(i[0]), icon=i[2][5:])  # menu without submenu
                    else:
                        create_menu_item(menu, i[1], self.on_click, int(i[0])) #menu without submenu

        return menu
Пример #7
0
    def on_click(self, event):
        """some menu elements are only available by ...

        :param event:
        :return:
        """
        from XMLtools import XMLmanager
        from boolConv import to_bool

        global serverdata

        configData = getConfigData(configfile, boolCrypt=False)

        storagePath = configData[1].extracted
        storagePath = storagePath.replace('\\', '/')

        # *** If chain to proof what was chosen ***
        # clean daily and download folder


        if event.Id == 10011:
            from UI.SearchRevision import searchrevdialog
            import UI.SearchRevision.refreshDB as refreshDB

            # update data base first
            stat = refreshDB.refresh(configfile, 'dat/sublinksdb.dat',  dailylinklist)
            exitStat, listValue, dailyDate = searchrevdialog.openSD(configfile) # -> open dialog and search for daily

            if exitStat: # break if search was interrupted
                return

            ret = 0
            if listValue != None:
                ret = dowloadDaily(configfile, listValue, dailyDate, storagePath) # Download selcted daily
                if ret == 1:
                    self.ShowBalloon("Info", "Already downloaded ... extracting")
                elif ret == 2:
                    self.ShowBalloon("Canceled", "Download canceled and file removed ...")
                # DOWNLOAD END

            # if we were successful with download start to extract daily version
            if not ret == 2:
                existent = unzipdaily(storagePath, listValue) # unzip downloaded package
                self.ShowBalloon("Extracted", "Starting main application.")

                # proof language in menustruct
                for i in menustruct.languagemenu:
                    if i[-1] == 'True':
                        language = i[1]

                path = storagePath + '/daily/' + listValue + '/'
                exelist, rootpath = getexeList(path)
                rendll(rootpath, language)

                #execute sampleintegration
                if os.path.isfile(storagePath + "/daily/" + listValue + '/sampleintegration.exe'):
                    launchWithoutConsole(storagePath + '/daily/' + listValue + '/sampleintegration.exe', None)
                else:
                    exelist = []
                    # get first executable in folder
                    path = (storagePath + '/daily/' + listValue)
                    exelist, rootexe = getexeList(path)

                    launchWithoutConsole(exelist[0], None)

                # this should be a silent process. There is no need to inform user if failed
                try:
                    com2_client.main('Client downloading: ' +  listValue)
                except:
                    pass

                x = XMLmanager.XMLmanager('dat/config.ini')
                copyMach = x.getIval(['machines','alwayscopy'])
                copyMach = to_bool(copyMach)

                if copyMach:
                    # copy machine definitions in background if settings turned to true
                    try:
                        self.ShowBalloon("Copy progress ...", "Copying machines in background.")
                        copyMDsilent(path) # -> def
                    except:
                        self.ShowBalloon("ERROR", "Something went wrong while copying machine folders.")

        # call calendar
        if event.Id == 10003:
            import calender
            from datetime import datetime

            dailyDate = calender.callCal()
            if dailyDate is not None:
                d = datetime.strptime(str(dailyDate), '%m/%d/%y %H:%M:%S')
                dailyDate = d.strftime('%Y-%m-%d')

                processDailyDate(configfile, 'write', dailyDate)

        # settings
        if event.Id == 10002:
            settingsDialogData = settingsdialog.start_SD(configfile, TI_handle=TI, version=__version__)
            # proof if something was changed
            if settingsDialogData[0]:
                #save decrypted user information
                serverdata.user = settingsDialogData[1]
                serverdata.passw = settingsDialogData[2]

        #exit daily
        if event.Id == 10001:
            try:
                # stop sheduler
                SH.kill_sheduler()

                TI.RemoveIcon()

                tr = ComThread('EXIT ')
                tr.start()
                tr.join()
                # destroy taskbaricon and running process

                wx.CallAfter(self.Destroy)

                # TODO try to control the threads and stop them in a safe way
                # this is a work around and a nasty one.
                tt = threading.enumerate()
                tt[0].release()

            except:
                wx.CallAfter(self.Destroy)

        # UPDATE getdaily
        if event.Id == 10008:
            TI.ShowBalloon('Silent Update', 'Downloading in background.', msec=5000, flags=0)
            ComThread('GETUPDATE').start()
            self.UPDATE_AVAILABLE = False

        return menu
Пример #8
0
    def menu_item_click(self, event):
        """When a menu was clicked this functions decides what to do with the passed menu ID
        """
        from XMLtools import XMLmanager
        from boolConv import to_bool

        configData = getConfigData(configfile, boolCrypt=False)

        storagePath = configData[1].extracted
        storagePath = storagePath.replace('\\', '/')

        if 500 < event.Id < 5000:
            for i in range(0, len(dailysubmenus), 2):
                subElement = dailysubmenus[i][0]
                subElementID = dailysubmenus[i][1]
                posMenuItem = event.Id - subElementID

                if 0 <= posMenuItem < 50:

                    execEXE = dailysubmenus[i+1][posMenuItem]

                    if execEXE == 'Delete daily':
                        # TODO we should provide the possibility to remove a bunch of elements by selecting from a list
                        # self.ShowBalloon('Removing', 'Deleting daily version: ' + subElement)
                        shutil.rmtree(storagePath + '/daily/' + subElement, ignore_errors=False, onerror=errorRemoveReadonly)
                        self.ShowBalloon('Removed', 'Daily ' + subElement + ' deleted')

                    # copy daily URL to clipboard
                    elif execEXE.find('clipboard') != -1:
                        CB = clipboard()
                        dailyDate = processDailyDate(configfile, 'read')
                        urlmw = dailyList.assemble_daily_url(serverdata.url, dailyDate.date)
                        CB.put(urlmw + subElement)

                    else:
                        # execf = 'daily' + '\\' + subElement + '\\' + execEXE
                        execf = execEXE

                        #proof language
                        for i in menustruct.languagemenu:
                            if i[-1] == 'True':
                                language = i[1]

                        # path = 'daily\\' + subElement + '\\'
                        pos = execEXE.rfind('/')
                        path = execEXE[0:pos]

                        if language == 'English':
                            rendll(path + '/', language)
                        else:
                            rendll(path + '/', language)

                        # do not use subprocess directly in a EXE standalone version.
                        # here are some issues with console
                        # rp = subprocess.Popen( execf,
                        #                    stdout=subprocess.PIPE,
                        #                    stderr=subprocess.STDOUT)
                        # TODO we should catch the error here if execution failes

                        launchWithoutConsole(execf, None)


        # *** DOWNLOAD AND EXECUTE DAILY ETC ***
        elif event.Id <= 500:

            self.ShowBalloon("Download", "Getting daily: " + dailylinklist[event.Id])

            # DOWNLOAD BEGIN
            dailyDate = processDailyDate(configfile, 'read') # read daily date from config.ini. This was chosen by user and configured with calender application
            ret = dowloadDaily(configfile, dailylinklist[event.Id], dailyDate, storagePath) # Download selcted daily
            if ret == 1:
                self.ShowBalloon("Info", "Already downloaded ... extracting ")
            elif ret == 2:
                self.ShowBalloon("Canceled", "Download canceled and file removed ...")
            # DOWNLOAD END

            # if we were successful with download start to extract daily version
            if not ret == 2:
                existent = unzipdaily(storagePath, dailylinklist[event.Id]) # unzip downloaded package
                self.ShowBalloon("Extracted", "Starting main application.")

                # proof language in menustruct
                for i in menustruct.languagemenu:
                    if i[-1] == 'True':
                        language = i[1]

                path = storagePath + '/daily/' + dailylinklist[event.Id] + '/'
                exelist, rootpath = getexeList(path)
                rendll(rootpath, language)

                #execute sampleintegration
                if os.path.isfile(storagePath + "/daily/" + dailylinklist[event.Id] + '/sampleintegration.exe'):
                    launchWithoutConsole(storagePath + '/daily/' + dailylinklist[event.Id] + '/sampleintegration.exe', None)
                else:
                    exelist = []
                    # get first executable in folder
                    path = (storagePath + '/daily/' + dailylinklist[event.Id])
                    exelist, rootexe = getexeList(path)

                    launchWithoutConsole(exelist[0], None)

                # this should be a silent process. There is no need to inform user if failed
                try:
                    com2_client.main('Client downloading: ' +  dailylinklist[event.Id])
                except:
                    pass

                x = XMLmanager.XMLmanager('dat/config.ini')
                copyMach = x.getIval(['machines','alwayscopy'])
                copyMach = to_bool(copyMach)

                if copyMach:
                    # copy machine definitions in background if settings turned to true
                    try:
                        self.ShowBalloon("Copy progress ...", "Copying machines in background.")
                        copyMDsilent(path) # -> def
                    except:
                        self.ShowBalloon("ERROR", "Something went wrong while copying machine folders.")

                # do not use subprocess directly in a EXE standalone version.
                # here are some issues with console
                # left comments here simply to remember. Was a lot of research to find out what is the issue
                # p = subprocess.Popen('daily\\' + dailylinklist[event.Id] + '\\sampleintegration.exe',
                #                      stdout=subprocess.PIPE,
                #                      stderr=subprocess.STDOUT)


        elif event.Id >= 5001 and event.Id < 6000:
            index = event.Id - 5001

            self.ShowBalloon("Download", "Getting documentation: " + docsubmenu[index])

            if os.path.isfile(storagePath + '/download/' + docsubmenu[index].replace('%20', ' ')):
                os.startfile(storagePath + '/download/' + docsubmenu[index])
            else:
                ret = dowloadDocu(configfile, docsubmenu[index], storagePath) # Download selcted daily
                if not ret == 2:
                    self.ShowBalloon("Downloaded", "Opening documentation")
                    os.startfile(storagePath + '/download/' + docsubmenu[index])


        elif event.Id >= 6001 and event.Id < 7001:
            # folder : tools\MWRhinoplugin
            exNr = event.Id - int(menustruct.rhinomenu[0][0])
            rhinopath = 'tools\\MWRhinoplugin\\' # TODO All paths should be stored in config file or related configuration py
            launchWithoutConsole(rhinopath + rhinolinklist[exNr], 'rhino')


        elif event.Id > 9000 and event.Id < 9100:
            if event.Id >= 9001:
                menuPos = ( event.Id - int(menustruct.languagemenu[0][0]) ) # get position of menu to change
                if menustruct.languagemenu[menuPos][-1] == 'False':
                    subMenuList = list(menustruct.languagemenu[menuPos])
                    subMenuList[-1] = 'True'
                    menustruct.languagemenu[menuPos] = tuple(subMenuList)
                    #mark all others as False then
                    for i in range(len(menustruct.languagemenu)):
                        if not i == menuPos:
                            subMenuList = list(menustruct.languagemenu[i])
                            subMenuList[-1] = 'False'
                            menustruct.languagemenu[i] = tuple(subMenuList)


        elif event.Id == 15000:
            try:
                shutil.rmtree(storagePath + '/daily/', ignore_errors=False, onerror=errorRemoveReadonly)
                shutil.rmtree(storagePath + '/download/', ignore_errors=False, onerror=errorRemoveReadonly)
            except:
                self.ShowBalloon('ERROR', 'Could not complete removal process. Try again close all daily applications and or try manually.')

            os.mkdir(storagePath + '/daily')
            os.mkdir(storagePath + '/download')

            self.ShowBalloon('Removed', 'Storage folder is cleaned up.')


        elif event.Id == 16000: # open storage path
            try:
                os.startfile(storagePath)
            except:
                pass

        return menu