完成Django的标签的功能
This commit is contained in:
17
main.py
17
main.py
@@ -5,6 +5,7 @@ from loguru import logger
|
||||
|
||||
from server_connection_tab import ServerConnectionTab
|
||||
from remote_commands_tab import RemoteCommandsTab
|
||||
from django_tab import DjangoTab
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
@@ -26,6 +27,10 @@ class MainWindow(QMainWindow):
|
||||
self.remote_commands_tab = RemoteCommandsTab()
|
||||
self.tabs.addTab(self.remote_commands_tab, "远程命令")
|
||||
|
||||
# 添加Django管理标签页
|
||||
self.django_tab = DjangoTab()
|
||||
self.tabs.addTab(self.django_tab, "Django")
|
||||
|
||||
# 连接标签页切换信号
|
||||
self.tabs.currentChanged.connect(self.on_tab_changed)
|
||||
|
||||
@@ -50,6 +55,18 @@ class MainWindow(QMainWindow):
|
||||
# 如果没有配置远程目录,初始化为默认目录
|
||||
self.remote_commands_tab.current_dir_display.setText("~")
|
||||
self.remote_commands_tab.refresh_directory()
|
||||
|
||||
# 当切换到Django标签页时,传递SSH客户端和用户名
|
||||
elif index == 2: # Django标签页
|
||||
ssh_client = self.server_connection_tab.get_ssh_client()
|
||||
self.django_tab.set_ssh_client(ssh_client)
|
||||
|
||||
# 获取当前选中的服务器配置中的用户名
|
||||
current_alias = self.server_connection_tab.alias_combo.currentText()
|
||||
if current_alias and current_alias in self.server_connection_tab.config_data:
|
||||
server_config = self.server_connection_tab.config_data[current_alias]
|
||||
username = server_config.get("username", "")
|
||||
self.django_tab.set_username(username)
|
||||
|
||||
if __name__ == "__main__":
|
||||
logger.add("app.log", rotation="10 MB")
|
||||
|
||||
Reference in New Issue
Block a user