|
|
|
@ -107,10 +107,12 @@ opposite_dir = { |
|
|
|
class mutant(QWidget): |
|
|
|
command_str = pyqtSignal(str) |
|
|
|
mqtt_str = pyqtSignal(str) |
|
|
|
mqtt_str_quiet = pyqtSignal(str,str) |
|
|
|
def __init__(self,player): |
|
|
|
mqtt_str_quiet = pyqtSignal(str,str) |
|
|
|
tab_color = pyqtSignal(int,str) |
|
|
|
def __init__(self,player,idx): |
|
|
|
QWidget.__init__(self) |
|
|
|
self.player=player |
|
|
|
self.idx=idx |
|
|
|
#file related |
|
|
|
self.path=player.usr |
|
|
|
|
|
|
|
@ -242,6 +244,12 @@ class mutant(QWidget): |
|
|
|
self.setLayout(self.layout) |
|
|
|
self.load_bank_paths() |
|
|
|
self.init_telnet() |
|
|
|
|
|
|
|
#self.set_color() |
|
|
|
|
|
|
|
def set_color(self): |
|
|
|
self.setAttribute(Qt.WA_StyledBackground, True) |
|
|
|
self.setStyleSheet('background-color: red;') |
|
|
|
|
|
|
|
def init_telnet(self): |
|
|
|
|
|
|
|
@ -937,6 +945,8 @@ class mutant(QWidget): |
|
|
|
self.me_check.setChecked(False) |
|
|
|
self.ba_check.setChecked(False) |
|
|
|
self.hu_check.setChecked(False) |
|
|
|
|
|
|
|
self.tab_color.emit(self.idx,'red') |
|
|
|
|
|
|
|
#Player starting condition |
|
|
|
def player_init(self): |
|
|
|
@ -957,6 +967,8 @@ class mutant(QWidget): |
|
|
|
self.me_check.setChecked(self.wander) |
|
|
|
self.ba_check.setChecked(self.bait) |
|
|
|
self.hu_check.setChecked(self.hunt) |
|
|
|
|
|
|
|
self.tab_color.emit(self.idx,'green') |
|
|
|
|
|
|
|
#Player starting condition |
|
|
|
def player_exit(self): |
|
|
|
@ -978,6 +990,8 @@ class mutant(QWidget): |
|
|
|
self.ba_check.setChecked(self.bait) |
|
|
|
self.hu_check.setChecked(self.hunt) |
|
|
|
|
|
|
|
self.tab_color.emit(self.idx,'red') |
|
|
|
|
|
|
|
#Resets connection with no activity |
|
|
|
def watchdog_t(self): |
|
|
|
if self.watchdog > 4: |
|
|
|
@ -1021,6 +1035,7 @@ class mutant(QWidget): |
|
|
|
self.command_str.emit("blurb\r\n") |
|
|
|
self.command_str.emit("deaf\r\n") |
|
|
|
self.command_str.emit("memorize "+self.spell+"\r\n") |
|
|
|
self.tab_color.emit(self.idx,'green') |
|
|
|
print("Character in play..") |
|
|
|
|
|
|
|
#New area, set index, get location |
|
|
|
@ -1239,7 +1254,7 @@ class mutant(QWidget): |
|
|
|
self.farm_stock_items() |
|
|
|
if self.auto_ion: |
|
|
|
self.convert_items() |
|
|
|
#print("convert") |
|
|
|
#push("convert") |
|
|
|
|
|
|
|
def process_keys(self, key): |
|
|
|
|
|
|
|
@ -1530,12 +1545,15 @@ class MainWindow(QMainWindow): |
|
|
|
print(player_list) |
|
|
|
for player in player_list: |
|
|
|
mutbox = QHBoxLayout() |
|
|
|
index = player_list.index(player) |
|
|
|
print(player.usr) |
|
|
|
mut = mutant(player) |
|
|
|
print(index) |
|
|
|
mut = mutant(player,index) |
|
|
|
self.mutant_list.append(mut) |
|
|
|
mutbox.addWidget(self.mutant_list[-1]) |
|
|
|
self.mutant_list[-1].mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.mutant_list[-1].mqtt_str_quiet.connect(self.send_mqtt_quiet) |
|
|
|
self.mutant_list[-1].tab_color.connect(self.color_tab) |
|
|
|
tab = QWidget() |
|
|
|
tab.setLayout(mutbox) |
|
|
|
self.tabs.addTab(tab,player.usr) |
|
|
|
@ -1559,6 +1577,9 @@ class MainWindow(QMainWindow): |
|
|
|
self.formGroupBox.addRow(self.text_button,self.text_input) |
|
|
|
self.layout.addLayout(self.formGroupBox) |
|
|
|
|
|
|
|
def color_tab(self,idx,color): |
|
|
|
self.tabs.tabBar().setTabTextColor(idx, QColor(color)) |
|
|
|
|
|
|
|
#Events like mouse movement and keyboard action that happen on the main form |
|
|
|
def eventFilter(self, source, event): |
|
|
|
#print(source) |
|
|
|
|