Exemple #1
0
    def OnInit(self):
        global client_id

        utils.assert_folders()
        utils.migrate_from_tmp()
        try:
            setup_log()
        except:
            wx.MessageBox('Another instance of Assembly is running', 'Unable to start',wx.OK | wx.ICON_ERROR)
            sys.exit(0)

        platform = utils.get_platform()
        auto_upgrade = utils.string2bool(platform['autoupgrade'])

        if len(sys.argv) > 1:
            utils.add_user_attribute('show_info_popup','True')
            utils.delete_folder_async('%s/upgrade' %os.getcwd())
            wx.MessageBox('Congratulations! Assembly64 was upgraded from version %s to %s.' %(sys.argv[1], version), 'Assembly64 upgraded!',wx.OK | wx.ICON_INFORMATION)

        try:
            utils.update_server_db()
            newer_available,force,available_version = utils.check_version(version)
            if newer_available and force:
                update_dia = UpdateDialog(None,"New version available", "New version available. Upgrade is vital!",auto_upgrade, True)
                update_dia.ShowModal()
                if update_dia.is_app_upgrade():
                    upgrade = UpgradeSplash()
                    upgrade.Show()
                    utils.do_upgrade(upgrade,version,platform)
                    os._exit(1)
            elif newer_available and not force:
                update_dia = UpdateDialog(None,"New version available", "New version available, but you can stay with this one.. For now!", auto_upgrade, False)
                update_dia.ShowModal()
                if update_dia.is_app_upgrade():
                    upgrade = UpgradeSplash()
                    upgrade.Show()
                    utils.do_upgrade(upgrade,version,platform)
                    os._exit(1)
        except FtpOverloadedException:
            wx.MessageBox('Too many users right now, please try later', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)
        except ftplib.all_errors as a:
            wx.MessageBox('Unable to communicate with Assembly64 server.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)
        except:
            wx.MessageBox('Unable to communicate with assembly64 server.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)

        if not utils.has_attribute('uid'):
            client_id = str(uuid.uuid1())
            utils.add_user_attribute('uid',client_id)
            post_ga_event('application','startup_new_user')

        else:
            client_id = utils.get_user_attribute('uid')
            post_ga_event('application','startup_existing_user')

        if not utils.has_attribute('show_info_popup'):
            utils.add_user_attribute('show_info_popup','true')

        if utils.has_attribute(delete_files_after_install) is False:
            utils.add_user_attribute(delete_files_after_install,'true')

        thread = Thread(target = update_db,args = (10, ))
        thread.start()

        AssemblySplash().Show()
        return 1
Exemple #2
0
    def __init__(self, parent, title):
        reload(sys)
        sys.setdefaultencoding('utf8')

        log_info('Assembly v.%s started' % version)
        Thread(target=login_user, args=(self,client_id)).start()

        if not initial_db_refresh_done:
            wx.MessageBox('Unable to communicate with server.', 'Assembly Error',wx.OK | wx.ICON_ERROR)
            sys.exit(0)

        width = 300
        height = 600

        wx.Frame.__init__(self, parent, pos=get_pos(width,height), title=title, size=(width,height))
        favicon = wx.Icon('images/bigicon2.ico',wx.BITMAP_TYPE_ICO)
        wx.Frame.SetIcon(self,favicon)
        menu_bar = wx.MenuBar()
        menu = wx.Menu()
        m_open = menu.Append(wx.ID_FILE1, "S&elect SDCard location", "Select the location where your SD card or such is located")
        self.Bind(wx.EVT_MENU, self.on_open, m_open)

        m_refresh_local_db = menu.Append(wx.ID_FILE3, "R&efresh db from server", "")
        self.Bind(wx.EVT_MENU, self.on_refresh_db, m_refresh_local_db)
        self.Bind(wx.EVT_MENU, self.on_exit,menu.Append(wx.ID_FILE8, "Exit", ""))

        menu_bar.Append(menu, "&File")

        artifactsMenu = wx.Menu()

        m_restorehidden = artifactsMenu.Append(wx.ID_FILE6, "Restore view")
        self.Bind(wx.EVT_MENU, self.restore_hidden, m_restorehidden)
        menu_bar.Append(artifactsMenu, "Artifacts")

        m_delta_artifacts = artifactsMenu.Append(wx.ID_FILE2, "Delete artifacts cache", "")
        self.Bind(wx.EVT_MENU, self.on_delete_artifacts, m_delta_artifacts)

        settingsMenu = wx.Menu()

        m_settings = settingsMenu.Append(wx.ID_FILE7, "Settings")
        self.Bind(wx.EVT_MENU, self.view_settings, m_settings)
        menu_bar.Append(settingsMenu, "Misc")

        m_log = settingsMenu.Append(wx.ID_FILE5, "View log", "")
        self.Bind(wx.EVT_MENU, self.on_show_log, m_log)

        m_about = settingsMenu.Append(wx.ID_FILE4, "About", "")
        self.Bind(wx.EVT_MENU, self.on_about, m_about)

        self.SetMenuBar(menu_bar)
        self.tree = wx.TreeCtrl(self, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_EDIT_LABELS)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.on_drag, self.tree)

        if utils.has_attribute(work_dir_key):
            work_dir = utils.get_user_attribute(work_dir_key)
            if os.path.exists(work_dir):
                global dir_name
                dir_name = work_dir
                update_tree_view(self)

        self.Show()

        if utils.get_bool_attribute('show_info_popup') :
            Thread(target=show_info, args=(self,)).start()