Ejemplo n.º 1
0
 def populate(self):
     total = 0
     self.ui.player_list.clear()
     for player in self.players.keys():
         list_item = QListWidgetItem(player)
         race = self.players[player].get_race()
         gender = self.players[player].get_gender()
         list_item.setIcon(QtGui.QIcon(preview_icon(race, gender)))
         self.ui.player_list.addItem(list_item)
         total += 1
     self.ui.total_label.setText(str(total) + " total")
     self.ui.player_list.setCurrentRow(0)
Ejemplo n.º 2
0
 def populate(self):
     total = 0
     self.ui.player_list.clear()
     for player in self.players.keys():
         list_item = QListWidgetItem(player)
         race = self.players[player].get_race()
         gender = self.players[player].get_gender()
         list_item.setIcon(QtGui.QIcon(preview_icon(race, gender)))
         self.ui.player_list.addItem(list_item)
         total += 1
     self.ui.total_label.setText(str(total) + " total")
     self.ui.player_list.setCurrentRow(0)
Ejemplo n.º 3
0
 def update_player_preview(self):
     species = self.ui.race.currentText()
     gender = self.get_gender()
     image = preview_icon(species, gender)
     self.ui.player_preview.setPixmap(image.scaled(64, 64))
     self.window.setWindowModified(True)
Ejemplo n.º 4
0
    def __init__(self, main_window):
        self.dialog = QDialog(main_window.window)
        self.ui = qt_appearance.Ui_Dialog()
        self.ui.setupUi(self.dialog)
        self.main_window = main_window

        assets_db_file = Config().read("assets_db")
        starbound_folder = Config().read("starbound_folder")
        self.assets = assets.Assets(assets_db_file, starbound_folder)
        self.species = self.assets.species()
        self.player = main_window.player

        race = main_window.ui.race.currentText()
        self.player.set_race(race)
        self.player.set_gender(main_window.get_gender())

        # Current player stats
        race = self.player.get_race()
        gender = self.player.get_gender()
        personality = self.player.get_personality()

        self.colors = {
            "body": self.player.get_body_directives(),
            "emote": self.player.get_emote_directives(),
            "hair": self.player.get_hair_directives(),
            "facial_hair": self.player.get_facial_hair_directives(),
            "facial_mask": self.player.get_facial_mask_directives()
        }
        color_values = ("body", "hair", "facial_hair", "facial_mask")

        current_appearance = {
            "hair": self.player.get_hair(),
            "facial_hair": self.player.get_facial_hair(),
            "facial_mask": self.player.get_facial_mask()
        }
        appearance_values = ("hair", "facial_hair", "facial_mask")

        # appearance groups/types
        for value in appearance_values:
            group_data = getattr(self.species, "get_%s_groups" % value)(race, gender)
            type_data = getattr(self.species, "get_%s_types" % value)(race, gender,
                                                                      current_appearance[value][0])
            group_widget = getattr(self.ui, value+"_group")
            for option in group_data:
                group_widget.addItem(option)
            group_widget.setCurrentText(current_appearance[value][0])
            if len(group_data) < 2: group_widget.setEnabled(False)

            type_widget = getattr(self.ui, value+"_type")
            for option in type_data:
                type_widget.addItem(option)
            type_widget.setCurrentText(current_appearance[value][1])
            if len(type_data) < 2: type_widget.setEnabled(False)

        # personality
        for option in self.species.get_personality():
            self.ui.personality.addItem(option[0])
        self.ui.personality.setCurrentText(personality)

        # set up color picker buttons
        for value in color_values:
            getattr(self.ui, value+"_color").clicked.connect(getattr(self, "new_%s_color_edit" % value))
            if len(self.colors[value]) == 0:
                getattr(self.ui, value+"_color").setEnabled(False)

        # player image
        image = preview_icon(race, gender)
        self.ui.player_preview.setPixmap(image.scaled(64, 64))