Skip to content

Commit

Permalink
Converted configs into list
Browse files Browse the repository at this point in the history
Converted configs into a list then removed the if block for choosing the config on start.
  • Loading branch information
Xeckt committed Feb 12, 2019
1 parent 6c0d640 commit e1ea87d
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import platform
import random
from widgets.Messagebox import MessageBox
from utils.config import config_reader
from utils.config import config_reader, config_choice
from utils.lastFileOpen import lastFileOpen, updateLastFileOpen
from widgets.Tabs import Tabs
from widgets.Content import Content
Expand All @@ -15,9 +15,8 @@
from widgets.Browser import Browser
from resources.materialblack import material_blue

config0 = config_reader(0)
config1 = config_reader(1)
config2 = config_reader(2)
configs = [config_reader(0), config_reader(1), config_reader(2)]

with open("default.json") as choice:
choiceIndex = int(choice.read())

Expand Down Expand Up @@ -79,16 +78,16 @@ def fileNameChange(self):
def onStart(self, index):

if index == 0:
editor = config0['editor']
editor = configs[0]['editor']

elif index == 1:
editor = config1['editor']
editor = configs[1]['editor']

elif index == 2:
editor = config2['editor']
editor = configs[2]['editor']

else:
editor = config0['editor']
editor = configs[0]['editor']

if editor["windowStaysOnTop"] is True:
self.setWindowFlags(Qt.WindowStaysOnTopHint)
Expand Down Expand Up @@ -492,15 +491,9 @@ def execute_file(self):
file = lastFileOpen()
app.setStyle('Fusion')
palette = QPalette()
if choiceIndex == 0:
editor = config0['editor']
elif choiceIndex == 1:
editor = config1['editor']
elif choiceIndex == 2:
editor = config2['editor']
else:
editor = config0['editor']
editor = configs[choiceIndex]['editor']
print(choiceIndex)

ex = Main()
palette.setColor(QPalette.Window, QColor(editor["windowColor"]))
palette.setColor(QPalette.WindowText, QColor(editor["windowText"]))
Expand Down

0 comments on commit e1ea87d

Please sign in to comment.