예제 #1
0
def journal_entry(cmdr, is_beta, system, station, entry, state):

    if this.system != system:
        this.system = system
        write_file('EDMC System.txt', this.system)

    if 'StarPos' in entry and this.starpos != tuple(entry['StarPos']):
        this.starpos = tuple(entry['StarPos'])
        write_file(
            'EDMC StarPos.txt',
            '%s %s %s' % (Locale.stringFromNumber(this.starpos[0], 5),
                          Locale.stringFromNumber(this.starpos[1], 5),
                          Locale.stringFromNumber(this.starpos[2], 5)))

    if this.station != station:
        this.station = station
        write_file('EDMC Station.txt', this.station)

    if entry['event'] in [
            'FSDJump', 'LeaveBody', 'Location', 'SupercruiseEntry',
            'SupercruiseExit'
    ] and entry.get('BodyType') in [None, 'Station']:
        if this.body:
            this.body = None
            write_file('EDMC Body.txt')
    elif 'Body' in entry:  # StartUp, ApproachBody, Location, SupercruiseExit
        if this.body != entry['Body']:
            this.body = entry['Body']
            write_file('EDMC Body.txt', this.body)
    elif entry['event'] == 'StartUp':
        this.body = None
        write_file('EDMC Body.txt')

    if this.stationorbody != (this.station or this.body):
        this.stationorbody = (this.station or this.body)
        write_file('EDMC Station or Body.txt', this.stationorbody)

    if this.stationorbodyorsystem != (this.station or this.body
                                      or this.system):
        this.stationorbodyorsystem = (this.station or this.body or this.system)
        write_file('EDMC Station or Body or System.txt',
                   this.stationorbodyorsystem)

    if this.shiptype != state['ShipType']:
        this.shiptype = state['ShipType']
        write_file('EDMC ShipType.txt',
                   ship_map.get(this.shiptype, this.shiptype))

    if this.shipname != (state['ShipName'] or this.shiptype):
        this.shipname = (state['ShipName'] or this.shiptype)
        write_file(
            'EDMC ShipName.txt', state['ShipName'] and state['ShipName']
            or ship_map.get(this.shiptype, this.shiptype))

    if this.shipident != state['ShipIdent']:
        this.shipident = state['ShipIdent']
        write_file('EDMC ShipID.txt',
                   ship_map.get(this.shipident, this.shipident))
예제 #2
0
def dashboard_entry(cmdr, is_beta, entry):
    if 'Latitude' in entry and 'Longitude' in entry:
        if this.latlon != (entry['Latitude'], entry['Longitude']):
            this.latlon = (entry['Latitude'], entry['Longitude'])
            write_file(
                'EDMC LatLon.txt',
                '%s %s' % (Locale.stringFromNumber(this.latlon[0], 6),
                           Locale.stringFromNumber(this.latlon[1], 6)))
    elif this.latlon:
        this.latlon = None
        write_file('EDMC LatLon.txt')
예제 #3
0
 def update_jumpspeed_speed(self):
     """
     Set the jump speed rate in the EDMC window
     """
     msg = " {}".format(Locale.stringFromNumber(self.speed(), 2))
     self.speed_widget["foreground"] = COLOR_NORM[self.appdesign]
     self.speed_widget.after(0, self.speed_widget.config, {"text": msg})
     msgnow = " {}  |".format(Locale.stringFromNumber(self.speednow(), 2))
     self.speednow_widget["foreground"] = COLOR_NORM[self.appdesign]
     self.speednow_widget.after(0, self.speednow_widget.config,
                                {"text": msgnow})
예제 #4
0
    def update_transaction_rate(self):
        """
        Set the transaction rate rate in the EDMC window
        """
        msg = " {}".format(Locale.stringFromNumber(self.rate(), 2))
        self.rate_widget["foreground"] = COLOR_NORM[self.appdesign]
        self.rate_widget.after(0, self.rate_widget.config, {"text": msg})

        msgnow = "  {}  |".format(Locale.stringFromNumber(self.ratenow(), 2))
        self.ratenow_widget["foreground"] = COLOR_NORM[self.appdesign]
        self.ratenow_widget.after(0, self.ratenow_widget.config,
                                  {"text": msgnow})
예제 #5
0
파일: load.py 프로젝트: quantegy/EvacCount
def updateCounts():
    '''
    Update displayed totals whenever the counts are updated
    '''
    item,session, total = this.evacuatedLabels[1]
    session["text"] = "{0}".format(Locale.stringFromNumber(counts[0],0))
    total["text"] = "{0}".format(Locale.stringFromNumber(totals[0],0))
    for i in range(2,len(this.evacuatedLabels)):
        item,session, total = this.evacuatedLabels[i]
        if this.sarSettings[i-2] == 1:
            session["text"] = "{0}".format(Locale.stringFromNumber(counts[i-1],0))
            total["text"] = "{0}".format(Locale.stringFromNumber(totals[i-1],0))
예제 #6
0
def updateUI(event=None):
    eliteSystem = this.lastEventInfo.get(BG_SYSTEM, None)
    message = this.lastEventInfo.get(BG_MESSAGE, None)
    if (this.enabled or this.overwrite.get()) and eliteSystem:
        this.errorLabel.grid_remove()
        this.unconfirmedSystem.grid(row=0, column=1, sticky=tk.W)
        this.unconfirmedSystem["text"] = eliteSystem.name
        this.unconfirmedSystem[
            "url"] = "https://www.edsm.net/show-system?systemName={}".format(
                urllib2.quote(eliteSystem.name))
        this.unconfirmedSystem["state"] = "enabled"
        distanceText = u"{distance} Ly".format(
            distance=Locale.stringFromNumber(eliteSystem.distance, 2))
        if eliteSystem.uncertainty > 0:
            distanceText = distanceText + u" (\u00B1{uncertainty})".format(
                uncertainty=eliteSystem.uncertainty)
        this.distanceValue["text"] = distanceText
        this.actionText["text"] = eliteSystem.action_text
        if this.clipboard.get():
            this.frame.clipboard_clear()
            this.frame.clipboard_append(eliteSystem.name)
    else:
        this.unconfirmedSystem.grid_remove()
        this.errorLabel.grid(row=0, column=1, sticky=tk.W)
        this.distanceValue["text"] = "?"
        this.actionText["text"] = "?"
        if not this.enabled and not this.overwrite.get():
            this.errorLabel["text"] = "EDSM/EDDN is disabled"
        else:
            this.errorLabel["text"] = message or "?"
예제 #7
0
    def update(self):

        if self.visible():

            capi_update=self.patrol_list and self.system and self.capi_update
            journal_update=self.patrol_list and self.system

            if journal_update or capi_update:
                self.sort_patrol()
                p=Systems.edsmGetSystem(self.system)
                self.nearest=self.getNearest(p)
                self.hyperlink['text']=self.nearest.get("system")
                self.hyperlink['url']="https://www.edsm.net/en/system?systemName={}".format(quote_plus(self.nearest.get("system")))
                self.distance['text']="{}ly".format(Locale.stringFromNumber(getDistance(p,self.nearest.get("coords")),2))
                self.infolink['text']=self.nearest.get("instructions")
                self.infolink['url']=self.parseurl(self.nearest.get("url"))

                self.infolink.grid()
                self.distance.grid()
                self.prev.grid()
                self.next.grid()
                self.capi_update=False

            else:
                if self.system:
                    self.hyperlink['text'] = "Fetching patrols..."
                else:
                    self.hyperlink['text'] = "Waiting for location"
                self.infolink.grid_remove()
                self.distance.grid_remove()
                self.prev.grid_remove()
                self.next.grid_remove()
예제 #8
0
 def update_transaction_rate(self):
     """
     Set the transaction rate rate in the EDMC window
     :param msg:
     :return:
     """
     msg = "{} Visits/hr".format(Locale.stringFromNumber(self.rate(), 2))
     self.rate_widget.after(0, self.rate_widget.config, {"text": msg})
예제 #9
0
def write_all():
    write_file('EDMC System.txt', this.system)
    write_file(
        'EDMC StarPos.txt',
        '%s %s %s' % (Locale.stringFromNumber(
            this.starpos[0], 5), Locale.stringFromNumber(this.starpos[1], 5),
                      Locale.stringFromNumber(this.starpos[2], 5)))
    write_file('EDMC Station.txt', this.station)
    write_file('EDMC Body.txt', this.body)
    write_file(
        'EDMC LatLon.txt', '%s %s' % (Locale.stringFromNumber(
            this.latlon[0], 6), Locale.stringFromNumber(this.latlon[1], 6)))
    write_file('EDMC Station or Body.txt', this.stationorbody)
    write_file('EDMC Station or Body or System.txt',
               this.stationorbodyorsystem)
    write_file('EDMC ShipType.txt', this.shiptype)
    write_file('EDMC ShipName.txt', this.shipname)
예제 #10
0
 def update_earned(self):
     """
     Set the transaction speed rate in the EDMC window
     :param msg:
     :return:
     """
     msg = "{} Cr".format(Locale.stringFromNumber(self.trip_earnings() + self.saved_earnings, 2))
     self.earned_widget.after(0, self.earned_widget.config, {"text": msg})
예제 #11
0
    def getBGSInstructions(self, bgs):
        target = 0.50 <= float(bgs.get("influence")) <= 0.65
        over = float(bgs.get("influence")) > 0.65
        under = float(bgs.get("influence")) < 0.50

        if self.getStates("active_states", bgs):
            states = " States: {}".format(self.getStates("active_states", bgs))
        else:
            states = ""

        # 2019-03-24T11:14:38.000Z
        d1 = datetime.strptime(bgs.get("updated_at"), '%Y-%m-%dT%H:%M:%S.%fZ')
        d2 = datetime.now()

        last_updated = (d2 - d1).days
        if last_updated == 0:
            update_text = ""
        elif last_updated == 1:
            update_text = ". Last updated 1 day ago"
        elif last_updated < 7:
            update_text = ". Last updated {} days ago".format(last_updated)
        elif last_updated > 6:
            update_text = ". Last updated {} days ago. Please jump into the system to update the stats".format(
                last_updated)

        # if  self.getStates("pending_states",bgs):
        # pstates=" Pending: {}".format(self.getStates("pending_states",bgs))
        # else:
        # pstates=""

        # debug(bgs)
        if target:
            retval = "Canonn Influence {}%{}{}".format(
                Locale.stringFromNumber(float(bgs.get("influence") * 100), 2),
                states, update_text)
        if over:
            retval = "Canonn Influence {}%{} Check #mission_minor_faction on discord for instructions.{}".format(
                Locale.stringFromNumber(float(bgs.get("influence") * 100), 2),
                states, update_text)
        if under:
            retval = "Canonn Influence {}%{} Please complete missions for Canonn to increase our influence{}".format(
                Locale.stringFromNumber(float(bgs.get("influence") * 100), 2),
                states, update_text)

        debug("{}: {}".format(bgs.get("system_name"), retval))
        return retval
예제 #12
0
 def update_hourlyincome(self):
     """
     Set the transaction speed rate in the EDMC window
     :param msg:
     :return:
     """
     msg = "{} Cr/hr".format(Locale.stringFromNumber(self.speed(), 2))
     self.speed_widget.after(0, self.speed_widget.config, {"text": msg})
예제 #13
0
 def update_jumpspeed_dist(self):
     """
     Set the jump speed rate in the EDMC window
     :param msg:
     :return:
     """
     msg = "{} Ly".format(Locale.stringFromNumber(self.trip_distance() + self.saved_distance, 2))
     self.dist_widget.after(0, self.dist_widget.config, {"text": msg})
예제 #14
0
 def update_jumpspeed_speed(self):
     """
     Set the jump speed rate in the EDMC window
     :param msg:
     :return:
     """
     msg = "{} Ly/hr".format(Locale.stringFromNumber(self.speed(), 2))
     self.speed_widget.after(0, self.speed_widget.config, {"text": msg})
예제 #15
0
def journal_entry(cmdr, is_beta, system, station, entry, state):

    if entry['event'] == 'Scan':
        try:
            if not float(entry['DistanceFromArrivalLS']):	# Only calculate for arrival star
                r = float(entry['Radius'])
                t = float(entry['SurfaceTemperature'])
                for i in range(len(WORLDS)):
                    (name, high, low, subType) = WORLDS[i]
                    (label, edsm, near, dash, far, ls) = this.worlds[i]
                    far_dist = int(0.5 + dfort(r, t, low))
                    radius = int(0.5 + r / LS)
                    if far_dist <= radius:
                        near['text'] = ''
                        dash['text'] = u'×'
                        far['text'] = ''
                        ls['text'] = ''
                    else:
                        if not high:
                            near['text'] = Locale.stringFromNumber(radius)
                        else:
                            near['text'] = Locale.stringFromNumber(int(0.5 + dfort(r, t, high)))
                        dash['text'] = '-'
                        far['text'] = Locale.stringFromNumber(far_dist)
                        ls['text'] = 'ls'
        except:
            for (label, edsm, near, dash, far, ls) in this.worlds:
                near['text'] = ''
                dash['text'] = ''
                far['text'] = ''
                ls['text'] = '?'

    elif entry['event'] == 'FSDJump':
        for (label, edsm, near, dash, far, ls) in this.worlds:
            edsm['text'] = ''
            edsm['url'] = ''
            near['text'] = ''
            dash['text'] = ''
            far['text'] = ''
            ls['text'] = ''

    if entry['event'] in ['Location', 'FSDJump'] and get_setting() & SETTING_EDSM:
        thread = threading.Thread(target = edsm_worker, name = 'EDSM worker', args = (entry['StarSystem'],))
        thread.daemon = True
        thread.start()
예제 #16
0
def updateDistances():
    if not this.coordinates:
        for (_, distance) in this.distanceLabels:
            distance["text"] = "? Ly"
    else:
        for i in range(len(this.distances)):
            system = this.distances[i]
            distance = calculateDistance(system["x"], system["y"], system["z"],
                                         *this.coordinates)
            this.distanceLabels[i][1]["text"] = "{0} Ly".format(
                Locale.stringFromNumber(distance, 2))

    _, distance = this.travelledLabels[0]
    distance["text"] = "{0} Ly".format(
        Locale.stringFromNumber(this.distanceTotal, 2))
    _, distance = this.travelledLabels[1]
    distance["text"] = "{0} Ly".format(
        Locale.stringFromNumber(this.distanceSession, 2))
예제 #17
0
 def update_earned(self):
     """
     Set the transaction sum in the EDMC window
     """
     msg = "  {}".format(
         Locale.stringFromNumber(self.trip_earnings() + self.saved_earnings,
                                 0))
     self.earned_widget["foreground"] = COLOR_NORM[self.appdesign]
     self.earned_widget.after(0, self.earned_widget.config, {"text": msg})
예제 #18
0
    def update_single(self):
        """
        Set the transaction speed rate for trip in the EDMC window
        """
        msg = "{}".format(Locale.stringFromNumber(self.trip_earnings(), 0))
        if self.trip_earnings() > 0:
            self.single_widget["foreground"] = COLOR_NORM[self.appdesign]
        else:
            self.single_widget["foreground"] = COLOR_RED[self.appdesign]

        self.single_widget.grid(row=2, column=1, sticky=tk.E, columnspan=2)
        self.single_widget.after(0, self.single_widget.config, {"text": msg})
예제 #19
0
    def update_hourlyincome(self):
        """
        Set the transaction speed rate in the EDMC window
        """
        msg = " {}".format(Locale.stringFromNumber(self.speed(), 2))
        if self.speed() > 0:
            self.speed_widget["foreground"] = COLOR_NORM[self.appdesign]
        else:
            self.speed_widget["foreground"] = COLOR_RED[self.appdesign]

        self.speed_widget.grid(row=1, column=2, sticky=tk.E)
        self.speed_widget.after(0, self.speed_widget.config, {"text": msg})

        msgnow = "  {}  |".format(Locale.stringFromNumber(self.speednow(), 2))
        if self.speednow() > 0:
            self.speednow_widget["foreground"] = COLOR_NORM[self.appdesign]
        else:
            self.speednow_widget["foreground"] = COLOR_RED[self.appdesign]

        self.speednow_widget.grid(row=1, column=1, sticky=tk.E)
        self.speednow_widget.after(0, self.speednow_widget.config,
                                   {"text": msgnow})
예제 #20
0
def updateValues(r,t,name):
    this.starused['text'] = name
    this.starused['url'] = 'https://www.edsm.net/show-system?systemName=%s&bodyName=%s' % (quote(this.systemName), quote(name))
    for i in range(len(WORLDS)):
        (name, high, low, subType) = WORLDS[i]
        (label, edsm, near, dash, far, ls) = this.worlds[i]
        far_dist = int(0.5 + dfort(r, t, low))
        radius = int(0.5 + r / LS)
        if far_dist <= radius:
            near['text'] = ''
            dash['text'] = u'×'
            far['text'] = ''
            ls['text'] = ''
        else:
            if not high:
                near['text'] = Locale.stringFromNumber(radius)
            else:
                near['text'] = Locale.stringFromNumber(int(0.5 + dfort(r, t, high)))
            dash['text'] = '-'
            far['text'] = Locale.stringFromNumber(far_dist)
            ls['text'] = 'ls'
    return 0
예제 #21
0
def updateUi():
    # labels for distances to systems
    row = 0
    for (system, distance) in this.distanceLabels:
        if len(this.distances) >= row + 1:
            s = this.distances[row]
            system.grid(row=row, column=0, sticky=tk.W)
            system["text"] = "Distance {0}:".format(s["system"])
            distance.grid(row=row, column=1, sticky=tk.W)
            distance["text"] = "? Ly"
            row += 1
        else:
            system.grid_remove()
            distance.grid_remove()

    # labels for total travelled distance
    settingTotal, settingSession, settingSessionOption = getSettingsTravelled()
    description, distance = this.travelledLabels[0]

    for i in range(len(this.travelledLabels)):
        description, distance = this.travelledLabels[i]
        if (i == 0 and settingTotal) or (i == 1 and settingSession):
            description.grid(row=row, column=0, sticky=tk.W)
            description["text"] = "Travelled ({0}):".format("total" if i ==
                                                            0 else "session")
            distance.grid(row=row, column=1, sticky=tk.W)
            distance["text"] = "{0} Ly".format(
                Locale.stringFromNumber(this.distanceTotal, 2) if i ==
                0 else Locale.stringFromNumber(this.distanceSession, 2))
            row += 1
        else:
            description.grid_remove()
            distance.grid_remove()

    if row == 0:
        this.emptyFrame.grid(row=0)
    else:
        this.emptyFrame.grid_remove()
예제 #22
0
def updatePrefsUI(event=None):
    for settingsUiElement in this.settingsUiElements:
        if settingsUiElement.hasData:
            if settingsUiElement.success:
                clearInputFields(settingsUiElement.systemEntry,
                                 settingsUiElement.xEntry,
                                 settingsUiElement.yEntry,
                                 settingsUiElement.zEntry)
                settingsUiElement.systemEntry.insert(
                    0, settingsUiElement.systemName)
                settingsUiElement.xEntry.insert(
                    0, Locale.stringFromNumber(settingsUiElement.x))
                settingsUiElement.yEntry.insert(
                    0, Locale.stringFromNumber(settingsUiElement.y))
                settingsUiElement.zEntry.insert(
                    0, Locale.stringFromNumber(settingsUiElement.z))
                this.errorLabel["text"] = settingsUiElement.statusText
                this.errorLabel.config(foreground="dark green")
            else:
                this.errorLabel["text"] = settingsUiElement.statusText
                this.errorLabel.config(foreground="red")

            settingsUiElement.edsmButton["state"] = tk.NORMAL
            settingsUiElement.resetResponseData()
예제 #23
0
def fillSystemInformationFromEDSM(label, systemEntry, xEntry, yEntry, zEntry):
    # TODO fix possible issues because of thread-safety
    if systemEntry.get() == "":
        label["text"] = "No system name provided."
        label.config(foreground="red")
        return  # nothing to do here

    edsmUrl = "https://www.edsm.net/api-v1/system?systemName={SYSTEM}&showCoordinates=1".format(
        SYSTEM=urllib2.quote(systemEntry.get()))
    systemInformation = None
    try:
        url = urllib2.urlopen(edsmUrl, timeout=15)
        response = url.read()
        edsmJson = json.loads(response)
        if "name" in edsmJson and "coords" in edsmJson:
            clearInputFields(systemEntry, xEntry, yEntry, zEntry)
            systemEntry.insert(0, edsmJson["name"])
            xEntry.insert(0, Locale.stringFromNumber(edsmJson["coords"]["x"]))
            yEntry.insert(0, Locale.stringFromNumber(edsmJson["coords"]["y"]))
            zEntry.insert(0, Locale.stringFromNumber(edsmJson["coords"]["z"]))
            label["text"] = "Coordinates filled in for system {0}".format(
                edsmJson["name"])
            label.config(foreground="dark green")
        else:
            label[
                "text"] = "Could not get system information for {0} from EDSM".format(
                    systemEntry.get())
            label.config(foreground="red")
    except:
        label[
            "text"] = "Could not get system information for {0} from EDSM".format(
                systemEntry.get())
        label.config(foreground="red")
        sys.stderr.write(
            "DistanceCalc: Could not get system information for {0} from EDSM".
            format(systemEntry.get()))
예제 #24
0
 def credits(self, value):
     return Locale.stringFromNumber(value, 0) + ' Cr'
예제 #25
0
    def getBGSInstructions(self, bgs, faction):
        target = 0.50 <= float(bgs.get("influence")) <= 0.65
        over = float(bgs.get("influence")) > 0.65
        under = float(bgs.get("influence")) < 0.50

        if self.getStates("active_states", bgs):
            statesraw = self.getStates("active_states", bgs).split(",")
            debug(statesraw)
            #statesraw=" States:
            #{}".format(self.getStates("active_states",bgs))
            states = ""

            for i in range(len(statesraw)):
                states = states + ", " + state_list[statesraw[i]]
        else:
            states = ""

        #2019-03-24T11:14:38.000Z
        d1 = datetime.strptime(bgs.get("updated_at"), '%Y-%m-%dT%H:%M:%S.%fZ')
        d2 = datetime.now()

        last_updated = (d2 - d1).days
        if last_updated == 0:
            update_text = ""
        elif last_updated == 1:
            update_text = ". Данные обновлены 1 день назад"
        elif last_updated < 7:
            update_text = ". Последнее обновление данных {} дней назад".format(
                last_updated)
        elif last_updated > 6:
            update_text = ". Последнее обновление данных {} дней назад. Пожалуйста прыгните в эту систему что бы обновить данные".format(
                last_updated)

        # if
        # self.getStates("pending_states",bgs):
        # pstates=" Pending:
        # {}".format(self.getStates("pending_states",bgs))
        # else:
        # pstates=""
        if faction == "Close Encounters Corps":
            contact = "Пожалуйста, свяжитесь с AntonyVern [СЕС]#5904 на сервере СЕС для получения инструкций"
        if faction == "EG Union":
            contact = "Пожалуйста, свяжитесь с HEúCMuT#1242 на сервере EGP для получения инструкций"
        if faction == "Royal Phoenix Corporation":
            contact = "Пожалуйста, свяжитесь с Saswitz#9598 на сервере RPSG для получения инструкций"
        #debug(bgs)
        if target:
            retval = "{} Влияние {}%{}{}".format(
                faction,
                Locale.stringFromNumber(float(bgs.get("influence") * 100), 2),
                states, update_text)
        if over:
            retval = "{} Влияние {}%{} {}{}.".format(
                faction,
                Locale.stringFromNumber(float(bgs.get("influence") * 100), 2),
                states, contact, update_text)
        if under:
            retval = "{} Влияние {}%{} Пожалуйста выполняйте миссии за {}, чтобы увеличить наше влияние {}".format(
                faction,
                Locale.stringFromNumber(float(bgs.get("influence") * 100), 2),
                states, faction, update_text)

        debug("{}: {}".format(bgs.get("system_name"), retval))
        return retval
예제 #26
0
 def fillEntries(s, x, y, z, systemEntry, xEntry, yEntry, zEntry):
     systemEntry.insert(0, s)
     xEntry.insert(0, Locale.stringFromNumber(x))
     yEntry.insert(0, Locale.stringFromNumber(y))
     zEntry.insert(0, Locale.stringFromNumber(z))
예제 #27
0
def stringFromNumber(a, b):
    return Locale.stringFromNumber(a, b)
예제 #28
0
파일: load.py 프로젝트: BlackyBPG/EDMC_GPL
    def update_systemfactions(self):
        x = 0
        xd = 0
        if len(self.systemfaction) > 0:
            self.frame.grid()
            self.oldlen = len(self.systemfaction)
            gplint = self.gplint
            repall = self.repall
            if self.showoth == 0:
                gplint = 0
                repall = 0

            showgpl = self.showgpl
            if gplint == 1:
                showgpl = 0

            showrep = self.showrep
            if repall == 1:
                showrep = 0

            while x < len(self.systemfaction):
                if self.showpil == 0 and self.systemfaction[x] == NAME_PIL:
                    xd = xd + 1
                elif showgpl == 0 and self.systemfactionmode[
                        x] == NAME_GPL_SHORT:
                    xd = xd + 1
                elif showrep == 0 and self.systemfactionmode[
                        x] == NAME_REPUTATION:
                    xd = xd + 1
                elif self.showoth == 0 and not (
                    (self.systemfactionmode[x] == NAME_REPUTATION
                     and showrep == 1) or
                    (self.systemfactionmode[x] == NAME_GPL_SHORT
                     and showgpl == 1)):
                    xd = xd + 1
                else:
                    self.widget_Name[x - xd].grid(row=x - xd,
                                                  column=0,
                                                  sticky=tk.W)
                    self.widget_State[x - xd].grid(row=x - xd,
                                                   column=1,
                                                   sticky=tk.E + tk.W,
                                                   padx=10)
                    if (self.systemfactionmode[x] == NAME_REPUTATION
                            and showrep == 1) or (self.systemfactionmode[x]
                                                  == NAME_GPL_SHORT
                                                  and showgpl == 1):
                        self.widget_Name[x - xd]["foreground"] = COLOR_NORM[
                            self.appdesign + 3]
                    elif (self.systemfactionmode[x] == "NoneSQ"
                          or self.systemfactionmode[x]
                          == "SYSSQ") and gplint == 1 and self.showgpl == 1:
                        self.widget_Name[x - xd]["foreground"] = COLOR_NORM[
                            self.appdesign + 3]
                    else:
                        self.widget_Name[x - xd]["foreground"] = COLOR_NORM[
                            self.appdesign]

                    faction = self.systemfaction[x]
                    system = self.systemsystem
                    native = self.getFactionNative(faction, system)
                    player = self.getFactionPlayer(faction)
                    if native == 1 or player == 1:
                        faction = "%s " % faction
                        if native == 1:
                            faction = "%s%s" % (faction, "[N]")
                        if player == 1:
                            faction = "%s%s" % (faction, "[P]")
                    if self.systemfactionmode[
                            x] == "SYS" or self.systemfactionmode[x] == "SYSSQ":
                        self.widget_Name[x - xd].after(
                            0, self.widget_Name[x - xd].config,
                            {"text": "! " + faction})
                    else:
                        self.widget_Name[x - xd].after(
                            0, self.widget_Name[x - xd].config,
                            {"text": faction})

                    self.widget_State[x - xd].after(
                        0, self.widget_State[x - xd].config,
                        {"text": self.systemfactionstate[x]})

                    msg = "{}".format(
                        Locale.stringFromNumber(self.systemfactioninflu[x], 3))
                    self.widget_Desc[x - xd].grid(row=x - xd,
                                                  column=3,
                                                  sticky=tk.E)
                    if self.showcol == 1:
                        red = COLOR_I_RED[int(100 -
                                              self.systemfactioninflu[x])]
                        green = COLOR_I_GREEN[int(100 -
                                                  self.systemfactioninflu[x])]
                        blue = COLOR_I_BLUE[int(100 -
                                                self.systemfactioninflu[x])]
                        if self.systemfactionmode[x] == NAME_REPUTATION:
                            red = COLOR_R_RED[int(100 -
                                                  self.systemfactioninflu[x])]
                            green = COLOR_R_GREEN[int(
                                100 - self.systemfactioninflu[x])]
                            blue = COLOR_R_BLUE[int(
                                100 - self.systemfactioninflu[x])]

                        hexrgb = "#%02x%02x%02x" % (red, green, blue)
                        if self.appdesign > 0:
                            self.widget_Desc[x - xd]["foreground"] = hexrgb
                            self.widget_ColorA[x - xd].grid_forget()
                        else:
                            self.widget_Desc[x -
                                             xd]["foreground"] = COLOR_NORM[
                                                 self.appdesign]
                            self.widget_ColorA[x - xd].grid(row=x - xd,
                                                            column=2,
                                                            sticky=tk.W)
                            self.widget_ColorA[x - xd]["foreground"] = hexrgb
                            self.widget_ColorA[x - xd]["background"] = hexrgb
                    else:
                        self.widget_ColorA[x - xd].grid_forget()

                    self.widget_Desc[x - xd].after(
                        0, self.widget_Desc[x - xd].config, {"text": msg})

                    self.widget_Perc[x - xd].grid(row=x - xd,
                                                  column=4,
                                                  sticky=tk.W)

                    if repall == 1 and self.showrep == 1 and not (
                        (self.systemfactionmode[x] == NAME_REPUTATION
                         and showrep == 1) or
                        (self.systemfactionmode[x] == NAME_GPL_SHORT
                         and showgpl == 1)):
                        msg = "{}".format(
                            Locale.stringFromNumber(
                                self.systemfactionreputation[x], 3))
                        self.widget_Rep[x - xd].grid(row=x - xd,
                                                     column=6,
                                                     sticky=tk.E)
                        red = COLOR_R_RED[int(100 -
                                              self.systemfactionreputation[x])]
                        green = COLOR_R_GREEN[int(
                            100 - self.systemfactionreputation[x])]
                        blue = COLOR_R_BLUE[int(
                            100 - self.systemfactionreputation[x])]

                        self.widget_Rep[x - xd]["foreground"] = COLOR_NORM[
                            self.appdesign]
                        if self.showcol == 1:
                            hexrgb = "#%02x%02x%02x" % (red, green, blue)
                            if self.appdesign > 0:
                                self.widget_Rep[x - xd]["foreground"] = hexrgb
                                self.widget_ColorB[x - xd].grid_forget()
                            else:
                                self.widget_ColorB[x - xd].grid(row=x - xd,
                                                                column=5,
                                                                sticky=tk.W)
                                self.widget_ColorB[x -
                                                   xd]["foreground"] = hexrgb
                                self.widget_ColorB[x -
                                                   xd]["background"] = hexrgb

                        self.widget_Rep[x - xd].after(
                            0, self.widget_Rep[x - xd].config, {"text": msg})

                        self.widget_PercRep[x - xd].grid(row=x - xd,
                                                         column=7,
                                                         sticky=tk.W)
                    else:
                        self.widget_Rep[x - xd].grid_forget()
                        self.widget_PercRep[x - xd].grid_forget()
                        self.widget_ColorB[x - xd].grid_forget()

                x = x + 1

            x = x - xd
            y = x
            while x < MAX_FACTIONS:
                self.widget_Name[x].grid_forget()
                self.widget_State[x].grid_forget()
                self.widget_Desc[x].grid_forget()
                self.widget_Perc[x].grid_forget()
                self.widget_Rep[x].grid_forget()
                self.widget_PercRep[x].grid_forget()
                self.widget_ColorA[x].grid_forget()
                self.widget_ColorB[x].grid_forget()
                x = x + 1

            if y == 0:
                self.frame.grid_remove()

        else:
            while x < MAX_FACTIONS:
                self.widget_Name[x].grid_forget()
                self.widget_State[x].grid_forget()
                self.widget_Desc[x].grid_forget()
                self.widget_Perc[x].grid_forget()
                self.widget_Rep[x].grid_forget()
                self.widget_PercRep[x].grid_forget()
                self.widget_ColorA[x].grid_forget()
                self.widget_ColorB[x].grid_forget()
                x = x + 1

            if self.oldlen > 0:
                self.frame.grid_remove()
                self.oldlen = 0