Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a43d864
Cleanup code
CloudsCoat Feb 23, 2023
ce6647f
Added opening request
CloudsCoat Feb 23, 2023
b9f4b97
Added remove request
CloudsCoat Feb 23, 2023
42b2b79
work in progress
CloudsCoat Feb 24, 2023
0dbe748
Removed Notifications
CloudsCoat Mar 28, 2023
689ce8e
deleted comment
CloudsCoat Mar 29, 2023
3cbffc3
added new unstatic command
CloudsCoat Mar 29, 2023
2eca914
fixed request widget bug
CloudsCoat Mar 29, 2023
f93011e
Added abiity to remove requests
CloudsCoat Mar 29, 2023
e2ac254
Changed ability to remove requests
CloudsCoat Mar 29, 2023
9bf8587
cleanup
CloudsCoat Mar 29, 2023
470a281
Bug fixes
CloudsCoat Mar 29, 2023
cfb963a
Update v1.1.0
CloudsCoat Apr 5, 2023
4d1cbe6
Fine tuning removing requests
CloudsCoat Apr 5, 2023
d3867b3
Request updating
CloudsCoat Apr 6, 2023
0f124cc
Delete row on updating requests
CloudsCoat Apr 6, 2023
dab905e
Update reloading batches
CloudsCoat Apr 7, 2023
fdaa18a
Update code
CloudsCoat Apr 11, 2023
aaa98c4
Update feedback
CloudsCoat Apr 12, 2023
abe6a5c
Remove request changed
CloudsCoat Apr 12, 2023
77c323a
Deleted timer (timer does not exist)
CloudsCoat Apr 17, 2023
76de20d
Work in progress
CloudsCoat Apr 17, 2023
512fdda
Fixed change propperties of batch
CloudsCoat Apr 20, 2023
4266cdb
Merge pull request #1 from computestdev/master
CloudsCoat Apr 20, 2023
24ae1b2
merge conflicts
CloudsCoat Apr 20, 2023
075dd1c
Added remove request
CloudsCoat Feb 23, 2023
4dc2758
work in progress
CloudsCoat Feb 24, 2023
06a952c
Removed Notifications
CloudsCoat Mar 28, 2023
780e196
deleted comment
CloudsCoat Mar 29, 2023
847f634
added new unstatic command
CloudsCoat Mar 29, 2023
72dc80e
fixed request widget bug
CloudsCoat Mar 29, 2023
73b6af6
Added abiity to remove requests
CloudsCoat Mar 29, 2023
5b81d7b
Changed ability to remove requests
CloudsCoat Mar 29, 2023
23e3711
cleanup
CloudsCoat Mar 29, 2023
fccb6ff
Bug fixes
CloudsCoat Mar 29, 2023
0e29758
merge conflicts
CloudsCoat Apr 20, 2023
8eb7057
Fine tuning removing requests
CloudsCoat Apr 5, 2023
4583f94
Request updating
CloudsCoat Apr 6, 2023
df61f96
Delete row on updating requests
CloudsCoat Apr 6, 2023
de214ee
Update reloading batches
CloudsCoat Apr 7, 2023
0e1c57f
Update code
CloudsCoat Apr 11, 2023
a2fa969
merge conflicts
CloudsCoat Apr 20, 2023
ba40bd9
Remove request changed
CloudsCoat Apr 12, 2023
378acc9
Deleted timer (timer does not exist)
CloudsCoat Apr 17, 2023
3e12bf3
Work in progress
CloudsCoat Apr 17, 2023
a48ff4e
Fixed change propperties of batch
CloudsCoat Apr 20, 2023
64c3acf
Merge remote-tracking branch 'origin/master'
CloudsCoat Apr 20, 2023
f78e0fb
Merge remote-tracking branch 'origin/1.2.0' into 1.2.0
CloudsCoat Apr 20, 2023
99f1498
Fix after merge
CloudsCoat Apr 20, 2023
02c43c7
Updated some checks
CloudsCoat May 8, 2023
57b9ab7
Fixed removing requests
CloudsCoat May 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CompuRacer_Core/src/command_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import src.utils as utils

from src.maingui import MainGUI
from src.connectgui import ConnectGUI

from PyQt5.QtCore import QThread, QObject, pyqtSignal
from PyQt5.QtCore import QThread, pyqtSignal
from PyQt5.QtWidgets import QApplication

__version__ = "v1"
__version__ = "v1.1.0"

class GuiThread(QThread):
start_gui_signal = pyqtSignal()
Expand Down Expand Up @@ -140,7 +140,7 @@ def gui_interpreter(self, state):
self.print_formatted("Starting GUI " + __version__ + "..", utils.QType.INFORMATION)
app = QApplication([])

MainGUI.show_requests_gui(self.racer, app, state, self)
ConnectGUI.show_requests_gui(self.racer, app, state, self)

def command_interpreter(self):
self.welcome_function(self.welcome_function_class)
Expand Down
69 changes: 29 additions & 40 deletions CompuRacer_Core/src/compu_racer_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class CompuRacer:
immediate_batch_name = "Imm"
progress_bar_width = 100

def __init__(self, port, proxy, queue, use_only_cli):
def __init__(self, port, proxy, queue, cli_check):
"""
Creates a new CompuRacer instance
:param queue: the queue to be used when we want to display a filepicker dialog to the user
Expand All @@ -110,7 +110,7 @@ def __init__(self, port, proxy, queue, use_only_cli):
# if the queue is None, we cannot and will not show dialogs
self.dialog_queue = queue

self.use_only_cli = use_only_cli
self.cli_check = cli_check

# add shutdown hooks
signal.signal(signal.SIGINT, self.force_shutdown)
Expand Down Expand Up @@ -201,7 +201,7 @@ def set_unchanged(self):
if self.command_processor.is_changed():
self.command_processor.set_changed(False)

def start(self, use_only_cli):
def start(self, cli_check):
"""
Starts the CompuRacer
"""
Expand All @@ -224,7 +224,7 @@ def start(self, use_only_cli):
self.print_formatted("Starting command processor..", utils.QType.INFORMATION)
time.sleep(0.25)
utils.clear_output()
self.command_processor.start(use_only_cli, self, self.state)
self.command_processor.start(cli_check, self, self.state)

def comm_general_save(self, do_print=True):
"""
Expand Down Expand Up @@ -895,19 +895,19 @@ def comm_requests_remove(self, request_id_first=None, request_id_last=None, ask_
self.print_formatted(f"Removal of all requests cancelled.", utils.QType.INFORMATION)
return
elif request_id_last is not None:
# remove a range of requests
if not ask_confirmation or self.command_processor.accept_yes_no(
f"Are you sure you want to remove requests with id between and including {request_id_first} and {request_id_last}?",
utils.QType.WARNING):
# remove a range of requests
for i, request_id in enumerate(copy.deepcopy(list(self.state['requests'].keys()))):
if request_id_first <= request_id <= request_id_last:
if self.rem_request(self, request_id, False) == -1:
failed_requests.append(request_id)
else:
success_requests.append(request_id)
else:
self.print_formatted(f"Removal of range of requests cancelled.", utils.QType.INFORMATION)
return
else:
self.print_formatted(f"Removal of range of requests cancelled.", utils.QType.INFORMATION)
return
else:
# remove one request
if self.rem_request(self, request_id_first, True) == -1:
Expand Down Expand Up @@ -1062,7 +1062,6 @@ def add_request(self, a_request, used_from_interface=False, print_information=Tr
return self.comm_batches_create_new(self, self.immediate_batch_name, False,
not used_from_interface,
allow_redirects, sync_last_byte, send_timeout)

immediate_batch = self.state['batches'][self.immediate_batch_name]
try:
immediate_batch.add(req_id, 0, par, seq, False)
Expand Down Expand Up @@ -1107,7 +1106,7 @@ def request_used_in(self, request_id):
return used_in

@staticmethod # do not add requests to this list in any other way
def rem_request(self, request_id, ask_confirmation=False):
def rem_request(self, request_id, ask_confirmation=True):
with self.requests_list_lock:
if request_id not in self.state['requests']:
self.print_formatted(f"Cannot remove request:\n\t"
Expand All @@ -1121,28 +1120,16 @@ def rem_request(self, request_id, ask_confirmation=False):
f"The request with id '{request_id}' is (also) used by the immediate batch!",
utils.QType.ERROR)
return -1
if not ask_confirmation:
if self.cli_check:
self.print_formatted(f"The request with id '{request_id}' is used by batches: "
f"{used_in}. It must be removed individually.",
utils.QType.ERROR)
return -1
# remove request from the batches
if not self.command_processor.accept_yes_no(f"The request with id '{request_id}' is used by batches: "
f"{used_in}, continue?\n\tIt will be removed from these batches and their results are cleared!!",
utils.QType.WARNING):
return -1
# remove request from the batches
for batch_name in used_in:
self.state['batches'][batch_name].remove(request_id)
ask_confirmation = False

if not ask_confirmation or self.command_processor.accept_yes_no(
f"Are you sure you want to remove the request with id '{request_id}'?",
utils.QType.WARNING):
self.__change_state('requests', sub_search=request_id, do_delete=True)
self.print_formatted(f"Request with id '{request_id}' is removed", utils.QType.INFORMATION)
else:
self.print_formatted(f"Removal of request cancelled.", utils.QType.INFORMATION)
self.__change_state('requests', sub_search=request_id, do_delete=True)
self.print_formatted(f"Request with id '{request_id}' is removed", utils.QType.INFORMATION)

# --------------------------------------------------------------------------------------------------- #
# ------------------------------------- Batch command functions ------------------------------------- #
Expand Down Expand Up @@ -1912,21 +1899,23 @@ def comm_curr_remove(self, request_id=None, wait_time=None):
self.print_formatted(f"Cannot remove a request from current batch: The current batch is empty!",
utils.QType.ERROR)
return -1
if request_id is None:
# remove all items from the batch
question = "Are you sure you want to remove all requests from the current batch?"
elif wait_time is None:
# remove all items with a certain ID from the batch
question = f"Are you sure you want to remove all requests with id '{request_id}' from the current batch?"
else:
# remove a specific item with a certain ID and wait_time from the batch
question = f"Are you sure you want to remove the request with id '{request_id}' and wait_time '{wait_time}' from the current batch?"
if self.command_processor.accept_yes_no(question, utils.QType.WARNING):
num_removed = curr_batch.remove(request_id, wait_time)
self.print_formatted(f"All matching requests are removed from the current batch.\nNumber: {num_removed}",
utils.QType.INFORMATION)
else:
self.print_formatted(f"Removal of current batch requests cancelled.", utils.QType.INFORMATION)
if self.cli_check:
if request_id is None:
# remove all items from the batch
question = "Are you sure you want to remove all requests from the current batch?"
elif wait_time is None:
# remove all items with a certain ID from the batch
question = f"Are you sure you want to remove all requests with id '{request_id}' from the current batch?"
else:
# remove a specific item with a certain ID and wait_time from the batch
question = f"Are you sure you want to remove the request with id '{request_id}' and wait_time '{wait_time}' from the current batch?"
if self.command_processor.accept_yes_no(question, utils.QType.WARNING):
num_removed = curr_batch.remove(request_id, wait_time)
self.print_formatted(f"All matching requests are removed from the current batch.\nNumber: {num_removed}",
utils.QType.INFORMATION)
num_removed = curr_batch.remove(request_id, wait_time)
self.print_formatted(f"All matching requests are removed from the current batch.\nNumber: {num_removed}",
utils.QType.INFORMATION)

# ------------------------------------------------------------------------------------------------- #
# ------------------------------------- Main helper functions ------------------------------------- #
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import os
import sys

from src.gui import RequestsGUI
from src.gui import MainGUI


class MainGUI:
class ConnectGUI:
def __init__(self, racer):
super().__init__()
self.racer = racer

def show_requests_gui(racer, app, state, cmdprocessor):
requests_gui = RequestsGUI(racer, state, cmdprocessor)
main_gui = MainGUI(racer, state, cmdprocessor)

requests_gui.show()
main_gui.show()
sys.exit(app.exec_())
Loading