Skip to content

Commit

Permalink
Revert "Merge branch 'testing' into master"
Browse files Browse the repository at this point in the history
This reverts commit 3a0a7aa, reversing
changes made to d6f35b1.
  • Loading branch information
BlivionIaG committed Nov 1, 2021
1 parent 3a0a7aa commit c0302ef
Show file tree
Hide file tree
Showing 23 changed files with 140 additions and 111 deletions.
76 changes: 21 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
</p>
<p align="center">
<a href="https://img.shields.io/badge/Compatible-MacOS%2FWindows%2FLinux-brightgreen?style=for-the-badge&logo=discord">
<img alt="Compatible OSes" src="https://img.shields.io/badge/Compatible-MacOS%2FLinux%2FWindows%2F-brightgreen?style=for-the-badge&logo=checkmarx&logoColor=white" />
<img src="https://img.shields.io/badge/Compatible-MacOS%2FLinux%2FWindows%2F-brightgreen?style=for-the-badge&logo=checkmarx&logoColor=white">
</a>
<a href="https://www.python.org/downloads/">
<img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/django?color=dark%20green&logo=python&logoColor=white&style=for-the-badge" />
<img src="https://img.shields.io/pypi/pyversions/django?color=dark%20green&logo=python&logoColor=white&style=for-the-badge">
</a>
<a href="https://discord.gg/P4h9kdV">
<img alt="Discord Server" src="https://img.shields.io/discord/742068289278312549?label=Discord&logo=discord&logoColor=white&style=for-the-badge" />
<img src="https://img.shields.io/discord/742068289278312549?label=Discord&logo=discord&logoColor=white&style=for-the-badge">
</a>
<a href="https://img.shields.io/badge/Compatible-MacOS%2FWindows%2FLinux-brightgreen?style=for-the-badge&logo=discord">
<img alt="Header Image" src="https://cdn.discordapp.com/attachments/695182849476657223/742064452421288077/FetchDis.png" />
<img src="https://cdn.discordapp.com/attachments/695182849476657223/742064452421288077/FetchDis.png"
</a>

</a>
Expand Down Expand Up @@ -105,7 +105,7 @@ Optionally for systemd users there is a user-side `fetchcord.service` in this re

To install FetchCord, run `pip3 install FetchCord`

NOTE: you need neofetch to be also installed for this to work. To do this, use `brew install neofetch`.
NOTE: you need neofetch to be also installed for this to work.

### Run

Expand Down Expand Up @@ -142,61 +142,27 @@ And more
default config path should be `~/.config/neofetch/config.conf`

## Arguments
`--nodistro`, Don't show distro info.

`--nohardware`, Don't show hardware info.

`--noshell`, Don't show shell/terminal info.

`--nohost`, Don't show host info.

`--noconfig`, Disable neofetch custom config. Enable if you have an incompatible custom configuration.

`--time TIME` or `-t TIME`, Set custom time in seconds for cycles. Default is 30 seconds seconds.

`--terminal TERMINAL`, Set custom Terminal (useful if using something like dmenu, or launching from a script).

`--termfont TERMFONT`, Set custom terminal font (useful if neofetch can't get it).

`--install`, Install fetchcord as a systemd service (user) and enable it.

`--uninstall`, Uninstall fetchcord as a systemd service (user).
--nodistro, Don't show distro info.

`--enable`, Enable fetchcord systemd service (user).
--nohardware, Don't show hardware info.

`--disable`, Disable fetchcord systemd service (user).
--noshell, Don't show shell/terminal info.

`--start`, Start fetchcord systemd service (user).
--nohost, Don't show host info.

`--stop`, Stop fetchcord systemd service (user).
--time, -t, set custom duration for cycles in seconds.

`--status`, Get fetchcord systemd service status (user).
--terminal, set custom terminal (useful if using a script or dmenu).

`--update`, Update database of distros, hardware, etc.
--termfont, set custom terminal font (useful if neofetch can't get it).

`--testing`, Get files from testing branch instead of master.
--pause-cycle, Extra cycle that pauses FetchCord to show other activities.

`--debug` or `-d`, Enable debugging.
--update, Update database of distros, hardware, etc.

`--pause-cycle`, Extra cycle that pauses for 30 seconds or custom time using --time argument.

`--memtype TYPE` or `-m TYPE`, Show Memory in GiB or MiB. Valid vaules are 'gb', 'mb'.

`--poll-rate RATE` or `-r RATE`, Set info polling rate.

`--version` or `-v`, Print FetchCord Version.

`--config-path CONFIG_PATH` or `-c CONFIG_PATH`, Specify custom neofetch config path.

`--fetchcord-config-path FETCHCORD_CONFIG_PATH` or `-fc FETCHCORD_CONFIG_PATH`, Specify custom fetchcord config path.

`--nfco NFCO` or `-nfco NFCO`, nfco.

`-h` or `--help`, shows this information above.

## Website
--debug, For debug logs.

Fetchcord now has a website! You can find this site over at [https://fetchcord.github.io/](https://fetchcord.github.io/) - please keep in mind this site is still currently a work in progress though and will have a proper domain soon.
--memtype, use GB or MB to show RAM.

--gui, open the fetchcord GUI

Expand All @@ -209,13 +175,13 @@ Fetchcord now has a website! You can find this site over at https://fetchcord.gi
## Examples

### Operating Systems
![MacOS Big Sur](Examples/mac.png) ![Windows 10](Examples/windows.png) ![Ubuntu](Examples/ubuntu.png)
![MacOS bigsur](Examples/mac.png) ![Windows 10](Examples/windows.png) ![Ubuntu](Examples/ubuntu.png)
### Terminals
![Konsole](Examples/konsole.png) ![Gnome Terminal](Examples/gnometerm.png) ![Apple Terminal](Examples/appleterm.png)
### CPUs
![Ryzen 9](Examples/ryzencpu.png) ![Intel i7](Examples/intelcpu.png) ![Intel Pentium](Examples/pent.png)
![Konsole](Examples/konsole.png) ![Gnome terminal](Examples/gnometerm.png) ![Apple terminal](Examples/appleterm.png)
### Cpus
![Ryzen 9](Examples/ryzencpu.png) ![Intel i7](Examples/intelcpu.png) ![Intel pentium](Examples/pent.png)
### Hosts
![HP laptop](Examples/hp.png) ![TUF gaming laptop](Examples/tuf.png) ![Lenovo desktop](Examples/len.png)
### GUI
Note that the GUI version may look different depending on your OS and Qt theme.
![GUI](Examples/gui.png)
![GUI](Examples/gui.png)
2 changes: 2 additions & 0 deletions fetch_cord/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# from __future__ import annotations

from typing import Dict
import sys, os

Expand Down
4 changes: 3 additions & 1 deletion fetch_cord/args.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# from __future__ import annotations

import argparse


def parse_args():

parser = argparse.ArgumentParser(
description="Fetch Cord\n https://github.com/MrPotatoBobx/FetchCord"
description="Fetch Cord\n" "https://github.com/MrPotatoBobx/FetchCord"
)
parser.add_argument(
"--nodistro", action="store_true", help="Don't show distro info."
Expand Down
14 changes: 8 additions & 6 deletions fetch_cord/computer/Computer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# from __future__ import annotations

import logging
from sys import platform, exit
import sys
Expand All @@ -17,6 +19,12 @@

args = parse_args()

# logger = Logger(
# "fetchcord_computer.log",
# "fetchcord_computer",
# logging.DEBUG if args.debug else logging.INFO,
# )


class Computer:
parseMap: Dict[str, Callable]
Expand Down Expand Up @@ -330,12 +338,6 @@ def fetch_values(self):
elif not self.get_component("Font:", True) and args.termfont:
self.componentMap["Font:"] = [args.termfont]

if not self.get_component("Motherboard", True) and self.os == "linux":
key = "Motherboard:"
if key not in self.componentMap:
self.componentMap[key] = []
self.parseMap[key](self.os, self.componentMap[key], "", key)

def updateMap(self):
"""
Clear the components values and fetch new ones
Expand Down
2 changes: 2 additions & 0 deletions fetch_cord/computer/Peripheral_interface.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#from __future__ import annotations

from abc import ABCMeta


Expand Down
2 changes: 2 additions & 0 deletions fetch_cord/computer/cpu/Cpu_amd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# from __future__ import annotations

import os
from sys import platform

Expand Down
4 changes: 3 additions & 1 deletion fetch_cord/computer/cpu/Cpu_intel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#from __future__ import annotations

from .Cpu_interface import Cpu_interface
import re

Expand Down Expand Up @@ -43,4 +45,4 @@ def get_temp(self):
"Temperature report for Intel CPU's is not supported on Linux yet."
)
else:
raise NotImplementedError("Unknown OS, no CPU temperature report.")
raise NotImplementedError("Unkown OS, no CPU temperature report.")
2 changes: 2 additions & 0 deletions fetch_cord/computer/cpu/Cpu_interface.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#from __future__ import annotations

from abc import ABCMeta, abstractmethod
from typing import Dict

Expand Down
2 changes: 2 additions & 0 deletions fetch_cord/computer/cpu/get_cpu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#from __future__ import annotations

from typing import List

from .Cpu_amd import Cpu_amd
Expand Down
2 changes: 2 additions & 0 deletions fetch_cord/computer/flatpak.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#from __future__ import annotations

from fetch_cord.run_command import BashError, exec_bash
import os

Expand Down
1 change: 1 addition & 0 deletions fetch_cord/computer/gpu/Gpu_amd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# from __future__ import annotations
from fetch_cord.run_command import BashError, exec_bash
from typing import List
import sys
Expand Down
1 change: 1 addition & 0 deletions fetch_cord/computer/gpu/Gpu_intel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# from __future__ import annotations
from .Gpu_interface import Gpu_interface

GPU_VENDOR = "intel"
Expand Down
1 change: 1 addition & 0 deletions fetch_cord/computer/gpu/Gpu_interface.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# from __future__ import annotations
from abc import ABCMeta, abstractmethod
from typing import List, TypeVar, Dict

Expand Down
1 change: 1 addition & 0 deletions fetch_cord/computer/gpu/Gpu_nvidia.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# from __future__ import annotations
from fetch_cord.run_command import BashError, exec_bash
from .Gpu_interface import Gpu_interface

Expand Down
1 change: 1 addition & 0 deletions fetch_cord/computer/gpu/get_gpu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# from __future__ import annotations
from typing import List

from .Gpu_amd import Gpu_amd
Expand Down
4 changes: 2 additions & 2 deletions fetch_cord/computer/mobo/get_mobo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


def get_mobo(os: str, line: List, value: str, key: str):
if os == "linux":
if(os == "linux"):
line.append(exec_bash("cat /sys/devices/virtual/dmi/id/board_vendor"))
else:
line.append(value[value.find(key) + len(key) + 1 :])
line.append(value[value.find(key) + len(key) + 1 :])
3 changes: 3 additions & 0 deletions fetch_cord/computer/resources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#from __future__ import annotations


try:
import importlib.resources as pkg_resources
except ImportError:
Expand Down
27 changes: 27 additions & 0 deletions fetch_cord/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#from __future__ import annotations


try:
import importlib.resources as pkg_resources
except ImportError:
Expand Down Expand Up @@ -33,6 +36,30 @@ def load_config():

return default_config


# def load_config():
# base_config = configparser.ConfigParser()
# base_config.read(["/etc/fetch_cord.conf"])
# base_config = _parsed_config_to_dict(base_config)
# _validate_config(base_config)


# # try:
# user_config = configparser.ConfigParser()
# user_config.read("/etc/fetch_cord.conf")
# user_config = _parsed_config_to_dict(user_config)
# # except configparser.ParsingError as e:
# # print(
# # "Error parsing config file %s. Falling back to default config %s. Error is : %s",
# # envs.USER_CONFIG_COPY_PATH, envs.DEFAULT_CONFIG_PATH, str(e))
# return base_config

# corrected_config = _validate_config(user_config, fallback_config=base_config)


# return corrected_config


def _validate_config(config, fallback_config=None):

folder_path = os.path.dirname(os.path.abspath(__file__))
Expand Down
90 changes: 46 additions & 44 deletions fetch_cord/cycles.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#from __future__ import annotations

import time
from typing import Dict

Expand Down Expand Up @@ -220,48 +222,48 @@ def cycle2(run: Run_rpc, key: str, computer: Computer):

def cycle3(run: Run_rpc, key: str, computer: Computer):
# if not then forget it
top_line = run.config["cycle_3"]["top_line"]
if top_line == "battery":
top_line = computer.battery if computer.battery != "Battery N/A" else " "
elif top_line == "host":
top_line = computer.motherboard
elif top_line == "resolution":
top_line = computer.resolution
bottom_line = run.config["cycle_3"]["bottom_line"]
if bottom_line == "resolution":
bottom_line = computer.resolution
elif bottom_line == "host":
bottom_line = computer.motherboard
elif bottom_line == "battery":
bottom_line = computer.battery if computer.battery != "Battery N/A" else " "
lapordesk_icon = run.config["cycle_3"]["lapordesk_icon"]
if lapordesk_icon == "on":
lapordesk_icon = computer.lapordesk
else:
lapordesk_icon = "off"
if args.debug:
print("cycle 3")
run.try_update(
key,
state=bottom_line,
details=top_line,
large_image="big",
large_text=computer.motherboard,
small_image=lapordesk_icon,
small_text=computer.lapordesk,
start=computer.uptime,
)
if args.debug:
print("appid: %s" % computer.motherboardappid)

config_time = run.config["cycle_3"]["time"]
if args.time:
time.sleep(int(args.time))
elif args.nodistro and args.nohardware and args.noshell:
time.sleep(9999)
elif config_time:
time.sleep(int(config_time))
else:
time.sleep(30)
if computer.host != "Host: N/A" and computer.motherboard != "Motherboard: N/A":
top_line = run.config["cycle_3"]["top_line"]
if top_line == "battery":
top_line = computer.battery
elif top_line == "host":
top_line = computer.motherboard
elif top_line == "resolution":
top_line = computer.resolution
bottom_line = run.config["cycle_3"]["bottom_line"]
if bottom_line == "resolution":
bottom_line = computer.resolution
elif bottom_line == "host":
bottom_line = computer.motherboard
elif bottom_line == "battery":
bottom_line = computer.battery
lapordesk_icon = run.config["cycle_3"]["lapordesk_icon"]
if lapordesk_icon == "on":
lapordesk_icon = computer.lapordesk
else:
lapordesk_icon = "off"
if args.debug:
print("cycle 3")
run.try_update(
key,
state=computer.resolution,
details=computer.battery,
large_image="big",
large_text=computer.motherboard,
small_image=lapordesk_icon,
small_text=computer.lapordesk,
start=computer.uptime,
)
if args.debug:
print("appid: %s" % computer.hostappid)
config_time = run.config["cycle_3"]["time"]
if args.time:
time.sleep(int(args.time))
elif args.nodistro and args.nohardware and args.noshell:
time.sleep(9999)
elif config_time:
time.sleep(int(config_time))
else:
time.sleep(30)
# back from whence you came
run.try_clear(key)
run.try_clear(key)
Loading

0 comments on commit c0302ef

Please sign in to comment.