cs2tracker 2.1.13__tar.gz → 2.1.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cs2tracker might be problematic. Click here for more details.

Files changed (44) hide show
  1. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/.isort.cfg +1 -1
  2. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/PKG-INFO +3 -2
  3. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/README.md +1 -1
  4. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/_version.py +2 -2
  5. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/app/application.py +72 -76
  6. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/app/editor_frame.py +208 -127
  7. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/app/scraper_frame.py +27 -10
  8. cs2tracker-2.1.14/cs2tracker/constants.py +136 -0
  9. cs2tracker-2.1.14/cs2tracker/data/config.ini +204 -0
  10. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/data/get_inventory.js +64 -21
  11. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/main.py +1 -16
  12. cs2tracker-2.1.14/cs2tracker/scraper/parsers.py +192 -0
  13. cs2tracker-2.1.14/cs2tracker/scraper/scraper.py +270 -0
  14. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/util/padded_console.py +19 -0
  15. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/util/validated_config.py +72 -18
  16. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker.egg-info/PKG-INFO +3 -2
  17. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker.egg-info/SOURCES.txt +1 -0
  18. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker.egg-info/requires.txt +1 -0
  19. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/requirements.txt +1 -0
  20. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/setup.cfg +1 -0
  21. cs2tracker-2.1.13/cs2tracker/constants.py +0 -399
  22. cs2tracker-2.1.13/cs2tracker/data/config.ini +0 -204
  23. cs2tracker-2.1.13/cs2tracker/scraper/scraper.py +0 -380
  24. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/.flake8 +0 -0
  25. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/.gitignore +0 -0
  26. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/.pre-commit-config.yaml +0 -0
  27. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/.pylintrc +0 -0
  28. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/LICENSE +0 -0
  29. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/MANIFEST.in +0 -0
  30. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/assets/icon.png +0 -0
  31. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/__init__.py +0 -0
  32. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/__main__.py +0 -0
  33. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/app/__init__.py +0 -0
  34. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/data/convert_inventory.js +0 -0
  35. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/data/output.csv +0 -0
  36. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/scraper/__init__.py +0 -0
  37. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/scraper/background_task.py +0 -0
  38. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/scraper/discord_notifier.py +0 -0
  39. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/util/__init__.py +0 -0
  40. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker/util/price_logs.py +0 -0
  41. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker.egg-info/dependency_links.txt +0 -0
  42. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker.egg-info/entry_points.txt +0 -0
  43. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/cs2tracker.egg-info/top_level.txt +0 -0
  44. {cs2tracker-2.1.13 → cs2tracker-2.1.14}/pyproject.toml +0 -0
@@ -1,2 +1,2 @@
1
1
  [settings]
2
- known_third_party = bs4,currency_converter,matplotlib,nodejs,requests,rich,sv_ttk,tenacity,tksheet,ttk_text,urllib3
2
+ known_third_party = bs4,currency_converter,matplotlib,nodejs,requests,requests_cache,rich,sv_ttk,tenacity,tksheet,ttk_text,urllib3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cs2tracker
3
- Version: 2.1.13
3
+ Version: 2.1.14
4
4
  Summary: Tracking the steam market prices of CS2 items
5
5
  Home-page: https://github.com/ashiven/cs2tracker
6
6
  Author: Jannik Novak
@@ -23,6 +23,7 @@ Requires-Dist: sv_ttk==2.6.1
23
23
  Requires-Dist: tksheet==7.5.12
24
24
  Requires-Dist: nodejs-bin==18.4.0a4
25
25
  Requires-Dist: ttk-text==0.2.0
26
+ Requires-Dist: requests-cache==1.2.1
26
27
  Dynamic: license-file
27
28
 
28
29
  <p align="center">
@@ -106,7 +107,7 @@ Dynamic: license-file
106
107
  ## Configuration
107
108
 
108
109
  You can configure the app settings via the **Edit Config** option.
109
- This will open the config editor where you can change any setting by simply double clicking on it. On top of that, the config editor allows you to:
110
+ This will open the config editor where you can change any setting by double clicking on it or navigating to it with the arrow keys and hitting enter. On top of that, the config editor allows you to:
110
111
 
111
112
  - Automatically import items from your Storage Units
112
113
  - Manually Specify the number of items you own
@@ -79,7 +79,7 @@
79
79
  ## Configuration
80
80
 
81
81
  You can configure the app settings via the **Edit Config** option.
82
- This will open the config editor where you can change any setting by simply double clicking on it. On top of that, the config editor allows you to:
82
+ This will open the config editor where you can change any setting by double clicking on it or navigating to it with the arrow keys and hitting enter. On top of that, the config editor allows you to:
83
83
 
84
84
  - Automatically import items from your Storage Units
85
85
  - Manually Specify the number of items you own
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '2.1.13'
21
- __version_tuple__ = version_tuple = (2, 1, 13)
20
+ __version__ = version = '2.1.14'
21
+ __version_tuple__ = version_tuple = (2, 1, 14)
@@ -34,46 +34,80 @@ config = get_config()
34
34
  class Application:
35
35
  def __init__(self):
36
36
  self.scraper = Scraper()
37
- self.application_window = None
38
37
 
39
38
  def run(self):
40
- """Run the main application window with buttons for scraping prices, editing the
41
- configuration, showing history in a chart, and editing the log file.
42
- """
43
- self.application_window = self._configure_window()
39
+ """Run the main application window."""
40
+ window = self._configure_window()
44
41
 
45
42
  if DARK_THEME:
46
43
  sv_ttk.use_dark_theme()
47
44
  else:
48
45
  sv_ttk.use_light_theme()
49
46
 
50
- self.application_window.mainloop()
47
+ window.mainloop()
48
+
49
+ def _configure_window(self):
50
+ """Configure the main application window."""
51
+ window = tk.Tk()
52
+ window.title(APPLICATION_NAME)
53
+ window.geometry(WINDOW_SIZE)
54
+
55
+ if OS == OSType.WINDOWS:
56
+ app_id = "cs2tracker.unique.id"
57
+ ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id)
58
+
59
+ icon = tk.PhotoImage(file=ICON_FILE)
60
+ window.wm_iconphoto(True, icon)
61
+
62
+ main_frame = MainFrame(window, self.scraper)
63
+ main_frame.pack(expand=True, fill="both")
64
+
65
+ return window
51
66
 
52
- def _add_button(self, frame, text, command, row):
67
+
68
+ class MainFrame(ttk.Frame):
69
+ # pylint: disable=too-many-instance-attributes,attribute-defined-outside-init
70
+ def __init__(self, parent, scraper):
71
+ super().__init__(parent, padding=15)
72
+ self.parent = parent
73
+ self.scraper = scraper
74
+ self._add_widgets()
75
+
76
+ def _add_widgets(self):
77
+ """Add widgets to the main frame."""
78
+ self.columnconfigure(0, weight=1)
79
+ self.columnconfigure(1, weight=1)
80
+ self.rowconfigure(0, weight=1)
81
+
82
+ self._configure_button_frame()
83
+ self.button_frame.grid(row=0, column=0, padx=10, pady=(7, 20), sticky="nsew")
84
+ self._configure_checkbox_frame()
85
+ self.checkbox_frame.grid(row=0, column=1, padx=10, pady=(0, 20), sticky="nsew")
86
+
87
+ def _add_button(self, text, command, row):
53
88
  """Create and style a button for the button frame."""
54
89
  grid_pos = {"row": row, "column": 0, "sticky": "ew", "padx": 10, "pady": 10}
55
- button = ttk.Button(frame, text=text, command=command)
90
+ button = ttk.Button(self.button_frame, text=text, command=command)
56
91
  button.grid(**grid_pos)
57
92
 
58
- def _configure_button_frame(self, main_frame):
93
+ def _configure_button_frame(self):
59
94
  """Configure the button frame of the application main frame."""
60
- button_frame = ttk.Frame(main_frame, style="Card.TFrame", padding=15)
61
- button_frame.columnconfigure(0, weight=1)
62
- button_frame.grid(row=0, column=0, padx=10, pady=(7, 20), sticky="nsew")
95
+ self.button_frame = ttk.Frame(self, style="Card.TFrame", padding=15)
96
+ self.button_frame.columnconfigure(0, weight=1)
63
97
 
64
- self._add_button(button_frame, "Run!", self.scrape_prices, 0)
65
- self._add_button(button_frame, "Edit Config", self._edit_config, 1)
66
- self._add_button(button_frame, "Show History", self._draw_plot, 2)
67
- self._add_button(button_frame, "Export History", self._export_log_file, 3)
68
- self._add_button(button_frame, "Import History", self._import_log_file, 4)
98
+ self._add_button("Run!", self.scrape_prices, 0)
99
+ self._add_button("Edit Config", self._edit_config, 1)
100
+ self._add_button("Show History", self._draw_plot, 2)
101
+ self._add_button("Export History", self._export_log_file, 3)
102
+ self._add_button("Import History", self._import_log_file, 4)
69
103
 
70
104
  def _add_checkbox(
71
- self, frame, text, variable, command, row
72
- ): # pylint: disable=too-many-arguments,too-many-positional-arguments
105
+ self, text, variable, command, row
106
+ ): # pylint: disable=too-many-arguments,too-many-positional-arguments,attribute-defined-outside-init
73
107
  """Create and style a checkbox for the checkbox frame."""
74
108
  grid_pos = {"row": row, "column": 0, "sticky": "w", "padx": (10, 0), "pady": 5}
75
109
  checkbox = ttk.Checkbutton(
76
- frame,
110
+ self.checkbox_frame,
77
111
  text=text,
78
112
  variable=variable,
79
113
  command=command,
@@ -81,90 +115,50 @@ class Application:
81
115
  )
82
116
  checkbox.grid(**grid_pos)
83
117
 
84
- def _configure_checkbox_frame(self, main_frame):
118
+ def _configure_checkbox_frame(self):
85
119
  """Configure the checkbox frame for background tasks and settings."""
86
- checkbox_frame = ttk.LabelFrame(main_frame, text="Settings", padding=15)
87
- checkbox_frame.grid(row=0, column=1, padx=10, pady=(0, 20), sticky="nsew")
120
+ self.checkbox_frame = ttk.LabelFrame(self, text="Settings", padding=15)
88
121
 
89
- background_checkbox_value = tk.BooleanVar(value=BackgroundTask.identify())
122
+ self.background_checkbox_value = tk.BooleanVar(value=BackgroundTask.identify())
90
123
  self._add_checkbox(
91
- checkbox_frame,
92
124
  "Background Task",
93
- background_checkbox_value,
94
- lambda: self._toggle_background_task(background_checkbox_value.get()),
125
+ self.background_checkbox_value,
126
+ lambda: self._toggle_background_task(self.background_checkbox_value.get()),
95
127
  0,
96
128
  )
97
129
 
98
- discord_webhook_checkbox_value = tk.BooleanVar(
130
+ self.discord_webhook_checkbox_value = tk.BooleanVar(
99
131
  value=config.getboolean("App Settings", "discord_notifications", fallback=False)
100
132
  )
101
133
  self._add_checkbox(
102
- checkbox_frame,
103
134
  "Discord Notifications",
104
- discord_webhook_checkbox_value,
105
- lambda: discord_webhook_checkbox_value.set(
106
- self._toggle_discord_webhook(discord_webhook_checkbox_value.get())
135
+ self.discord_webhook_checkbox_value,
136
+ lambda: self.discord_webhook_checkbox_value.set(
137
+ self._toggle_discord_webhook(self.discord_webhook_checkbox_value.get())
107
138
  ),
108
139
  1,
109
140
  )
110
141
 
111
- use_proxy_checkbox_value = tk.BooleanVar(
142
+ self.use_proxy_checkbox_value = tk.BooleanVar(
112
143
  value=config.getboolean("App Settings", "use_proxy", fallback=False)
113
144
  )
114
145
  self._add_checkbox(
115
- checkbox_frame,
116
146
  "Proxy Requests",
117
- use_proxy_checkbox_value,
118
- lambda: use_proxy_checkbox_value.set(
119
- self._toggle_use_proxy(use_proxy_checkbox_value.get())
147
+ self.use_proxy_checkbox_value,
148
+ lambda: self.use_proxy_checkbox_value.set(
149
+ self._toggle_use_proxy(self.use_proxy_checkbox_value.get())
120
150
  ),
121
151
  2,
122
152
  )
123
153
 
124
- # pylint: disable=attribute-defined-outside-init
125
154
  self.dark_theme_checkbox_value = tk.BooleanVar(value=DARK_THEME)
126
- self._add_checkbox(
127
- checkbox_frame, "Dark Theme", self.dark_theme_checkbox_value, sv_ttk.toggle_theme, 3
128
- )
129
-
130
- def _configure_main_frame(self, window):
131
- """Configure the main frame of the application window with buttons and
132
- checkboxes.
133
- """
134
- main_frame = ttk.Frame(window, padding=15)
135
- main_frame.columnconfigure(0, weight=1)
136
- main_frame.columnconfigure(1, weight=1)
137
- main_frame.rowconfigure(0, weight=1)
138
-
139
- self._configure_button_frame(main_frame)
140
- self._configure_checkbox_frame(main_frame)
141
-
142
- main_frame.pack(expand=True, fill="both")
143
-
144
- def _configure_window(self):
145
- """Configure the main application window UI and add buttons for the main
146
- functionalities.
147
- """
148
- window = tk.Tk()
149
- window.title(APPLICATION_NAME)
150
- window.geometry(WINDOW_SIZE)
151
-
152
- if OS == OSType.WINDOWS:
153
- app_id = "cs2tracker.unique.id"
154
- ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id)
155
-
156
- icon = tk.PhotoImage(file=ICON_FILE)
157
- window.wm_iconphoto(True, icon)
158
-
159
- self._configure_main_frame(window)
160
-
161
- return window
155
+ self._add_checkbox("Dark Theme", self.dark_theme_checkbox_value, sv_ttk.toggle_theme, 3)
162
156
 
163
157
  def scrape_prices(self):
164
158
  """Scrape prices from the configured sources, print the total, and save the
165
159
  results to a file.
166
160
  """
167
- scraper_window = tk.Toplevel(self.application_window)
161
+ scraper_window = tk.Toplevel(self.parent)
168
162
  scraper_window.geometry(SCRAPER_WINDOW_SIZE)
169
163
  scraper_window.title(SCRAPER_WINDOW_TITLE)
170
164
 
@@ -179,7 +173,7 @@ class Application:
179
173
 
180
174
  def _edit_config(self):
181
175
  """Open a new window with a config editor GUI."""
182
- config_editor_window = tk.Toplevel(self.application_window)
176
+ config_editor_window = tk.Toplevel(self.parent)
183
177
  config_editor_window.geometry(CONFIG_EDITOR_SIZE)
184
178
  config_editor_window.title(CONFIG_EDITOR_TITLE)
185
179
 
@@ -235,6 +229,7 @@ class Application:
235
229
  messagebox.showerror(
236
230
  "Config Error",
237
231
  "You need to enter a valid crawlbase API key into the configuration to use this feature.",
232
+ parent=self.parent,
238
233
  )
239
234
  return False
240
235
 
@@ -248,6 +243,7 @@ class Application:
248
243
  messagebox.showerror(
249
244
  "Config Error",
250
245
  "You need to enter a valid Discord webhook URL into the configuration to use this feature.",
246
+ parent=self.parent,
251
247
  )
252
248
  return False
253
249