Skip to content

Commit

Permalink
Updates for tech window
Browse files Browse the repository at this point in the history
  • Loading branch information
wizzomafizzo committed Apr 7, 2014
1 parent 20ba57c commit 15fc74f
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 27 deletions.
9 changes: 6 additions & 3 deletions starcheat/gui/techs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ def __init__(self, main_window):

self.ui.tech_list.currentItemChanged.connect(self.update_selection)

known_recipes = [x["name"] for x in self.player.get_blueprints()]
self.techs = self.player.get_tech_modules()
#print(self.techs)

#known_recipes = [x["name"] for x in self.player.get_blueprints()]
self.ui.tech_list.clear()
for tech in self.assets.techs().all():
item = QListWidgetItem(tech)
if tech in known_recipes:
item.setBackground(QBrush(QColor("lightBlue")))
#if tech in known_recipes:
# item.setBackground(QBrush(QColor("lightBlue")))
self.ui.tech_list.addItem(item)

def update_selection(self):
Expand Down
4 changes: 3 additions & 1 deletion starcheat/saves.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ def unpack_var(var, data):
if pattern in save_file_types:
return save_file_types[pattern][0](data)
else:
# TODO: same here, can we make it unpack()?
return unpack_from(pattern, data, 0), length

def pack_var(var, data):
Expand Down Expand Up @@ -529,6 +528,9 @@ def get_game_mode(self):
def get_play_time(self):
return self.entity["playTime"]

def get_tech_modules(self):
return self.entity["techController"]["techModules"]

# here be setters
def set_blueprints(self, blueprints):
self.entity["blueprints"] = blueprints
Expand Down
122 changes: 99 additions & 23 deletions starcheat/templates/Techs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>425</width>
<height>330</height>
<width>430</width>
<height>290</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>425</width>
<height>330</height>
<width>430</width>
<height>290</height>
</size>
</property>
<property name="windowTitle">
<string>Manage Techs</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="tech_modules">
Expand Down Expand Up @@ -191,6 +194,29 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="icon1_clear">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -246,6 +272,29 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="icon2_clear">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -301,6 +350,29 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="icon3_clear">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -356,6 +428,29 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="icon4_clear">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</normaloff>:/starcheat/images/icons/glyphicons_halflings_082_remove-sign.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -383,25 +478,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="passive_techs">
<property name="title">
<string>Passive Techs</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="multijump">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Multijump</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
Expand Down

0 comments on commit 15fc74f

Please sign in to comment.