è·æ¥ïŒãšç§ã¯ããã°ã©ããŒãšããŠïŒã«ãã£ãŠããªã¢ãŒããµãŒããŒäžã§ããããšããããããããsshçµç±ã§ã®ã¿ã¢ã¯ã»ã¹ã§ããŸãã ãŸããããã°ã©ã ãããŒã«ã«ã§èšè¿°ããŠãããã°ãããããåäœäžã®ãã·ã³ã«çœ®ãã®ãæã䟿å©ã§ãã ãããã£ãŠãsshfsã䜿çšãããšäŸ¿å©ã§ãã ããããæ¯åmountã³ãã³ããå ¥åããã®ã¯ããããã§ããã¿ã¯ãŒã§ã¹ã¯ãªãããæžãã®ã¯é¢åã§ãã ãã®ãããsshfsããŠã³ãã°ã©ãã£ã«ã«ãããŒãžã£ãŒãããã³KDE4ã®ä»ã®ãã¹ãŠã®ãã®ãå¿ èŠã§ããã
代æ¿æ¡
åœç¶ã圌ã¯èªåã§æžããŠãããæåŸãŸã§æµæããŸããã GoogleãçãããããŸããã ããããé©åãªãã®ã¯èŠã€ãããŸããã§ããã
KDE3ã§ã®ã¿äœããã®çç±ã§ç²åŸããksshfs
sshfsguiãåäœãæã¿ãŸããã§ãããããã€ãã®Javaãšã©ãŒãæããããŸããã yavamashinã®ããã€ãã®ç°ãªãããŒãžã§ã³ãšå®è£ ãè©ŠããŠã¿ãŸãã-å©ãã«ã¯ãªããŸããã§ããã
èªåã§ãããªããã°ãªããŸããã
èªã
ãŸããKDE4çšã®ã¢ããªã±ãŒã·ã§ã³ãã©ã®ããã«äœæããŸããïŒ ãã®ç¥èã¯ã ãProgramming for KDE4ããšããèšäºããåŠã³ãŸããã
æ®ãã¯ããã¥ã¡ã³ãã«ãã£ãŠå©ããããŸããã
ãã¬ãŒã
ã€ã³ã¿ãŒãã§ã€ã¹ã®èŠ³ç¹ãããç§ã¯sshfsguiã«çŠç¹ãåãããŸããã ããããå§ããŸãã
ãŸããã¢ããªã±ãŒã·ã§ã³ã®ãã¬ãŒã ã¯ãŒã¯ã䜿çšããŸãã
PyKDE4 ãã ã kdeui import KApplication ã KMainWindow ã KPushButton ã KHBox ã KVBox ã KLineEdit ã KListWidget
PyKDE4 ãã ã kdecore import i18n ã ki18n ã KAboutData ã KCmdLineArgs
PyQt4 ãã QtCoreã ã€ã³ããŒã
PyQt4 ãã ã QtGui import Qlabel
ã€ã³ããŒãã·ã¹ãã
ã¯ã©ã¹ pyksshfsWindow ïŒ KMainWindow ïŒ ïŒ
selected_name = False
def __init__ ïŒselfãparent = NoneïŒ ïŒ#constructor
KMainWindow ã __init__ ïŒ self ã parent ïŒ ïŒèŠªã³ã³ã¹ãã©ã¯ã¿ãŒãåŒã³åºã
appName = "pyksshfs"
ã«ã¿ãã° = ""
programName = ki18n ïŒ "PyKSshfs" ïŒ
ããŒãžã§ã³ = "0.1"
description = ki18n ïŒ ã sshfs ã䜿çšããããã®GUIã¢ããªã±ãŒã·ã§ã³ã ïŒ
ã©ã€ã»ã³ã¹ = KAboutData License_GPL
copyright = ki18n ïŒ "©Akademic" ïŒ
ããã¹ã = ki18n ïŒ "none" ïŒ
homePage = "ããã°ã©ã ãµã€ã"
bugEmail = "ãšã©ãŒã«ã€ããŠäœæè ãšéä¿¡ããããã®ã¡ãŒã«"
aboutData = KAboutData ïŒ appName ã catalog ã programName ã version ã description ã license ã copyright ã text ã homePage ã bugEmail ïŒ
KCmdLineArgs ã init ïŒ sysãargv ã aboutData ïŒ
app = KApplication ïŒ ïŒ
w = pyksshfsWindow ïŒ ïŒ
w 衚瀺 ïŒ ïŒ
ã¢ã㪠exec_ ïŒ ïŒ
ç§ã¯äžã€ã®ããšãèšããŸã-ããã¯ãã§ã«çºå£²ãããŠããããã®èãã¯ç§ã®å¿ãæž©ããŸãã 次ã®ããã«ãªããŸãã
ã€ã³ã¿ãŒãã§ãŒã¹
ããã°ã©ã ã¯2æéã§ãå®éã«åçŽãªã®ã§ãã€ã³ã¿ãŒãã§ã€ã¹ã«é¢é£ãããã¹ãŠã®ãã®ã__init__ã¡ãœããã«é 眮ããŸããã Qt Designerã§èŠããã®ã§ã¯ãªããã³ãŒããæžãã ãã§ãã
次ã®ããã«ãªããŸãã
def __init__ ïŒ self ã parent = None ïŒ ïŒ #constructor
KMainWindow ã __init__ ïŒ self ã parent ïŒ ïŒèŠªã³ã³ã¹ãã©ã¯ã¿ãŒãåŒã³åºã
hbox = KHBox ïŒ self ïŒ ïŒæ°Žå¹³ã¬ã€ã€ãŒãäœæ
hbox setMargin ïŒ 10 ïŒ ïŒ10ãã¯ã»ã«ã®ã€ã³ãã³ã
èªå·± ã setCentralWidget ïŒ hbox ïŒ ïŒã¡ã€ã³ã«ãã
ïŒã¡ã€ã³æ°Žå¹³å ã®2ã€ã®åçŽã¬ã€ã€ãŒ
vbox_left = KVBox ïŒ hbox ïŒ
vbox_right = KVBox ïŒ hbox ïŒ
ïŒæ£ããã¬ã€ã€ãŒãäžã«æãã
hbox ã¬ã€ã¢ãŠã ïŒ ïŒ ã setAlignment ïŒ vbox_right ã QtCoreãQtãAlignTop ïŒ
ïŒããŠã³ãçšã®ããŒã¿å ¥åçšãã£ãŒã«ã
entry_name_label = QLabel ïŒ 'NameïŒ' ã vbox_right ïŒ
èªå·± ã entry_name = KLineEdit ïŒ vbox_right ïŒ
server_address_label = QLabel ïŒ 'ãµãŒããŒã¢ãã¬ã¹ïŒ' ã vbox_right ïŒ
èªå·± ã server_address = KLineEdit ïŒ vbox_right ïŒ
server_port_label = QLabel ïŒ 'ãµãŒããŒããŒãïŒ' ã vbox_right ïŒ
èªå·± ã server_port = KLineEdit ïŒ vbox_right ïŒ
user_name_label = QLabel ïŒ 'UsernameïŒ' ã vbox_right ïŒ
èªå·± ã user_name = KLineEdit ïŒ vbox_right ïŒ
remote_path_label = QLabel ïŒ 'ãªã¢ãŒããã¹ïŒ' ã vbox_right ïŒ
èªå·± ã remote_path = KLineEdit ïŒ vbox_right ïŒ
local_path_label = QLabel ïŒ 'Local pathïŒ' ã vbox_right ïŒ
èªå·± ã local_path = KLineEdit ïŒ vbox_right ïŒ
ïŒãã¿ã³ã®ããŠã³ããšã¢ã³ããŠã³ã
ïŒå¥ã®ã¬ã€ã€ãŒãäœæ
btn_hbox_right = KHBox ïŒ vbox_right ïŒ
connect_btn = KPushButton ïŒ btn_hbox_right ïŒ
connect_btn ã setText ïŒ i18n ïŒ 'æ¥ç¶' ïŒ ïŒ
disconnect_btn = KPushButton ïŒ btn_hbox_right ïŒ
disconnect_btn ã setText ïŒ i18n ïŒ 'åæ' ïŒ ïŒ
ïŒä¿åæžã¿ãããã¡ã€ã«ã®ãªã¹ã
saved_list_label = QLabel ïŒ 'Stored connectionsïŒ' ã vbox_left ïŒ
èªå·± ã saved_list = KListWidget ïŒ vbox_left ïŒ
èªå·± ã saved_list ã setMaximumWidth ïŒ 150 ïŒ
ïŒãããã¡ã€ã«ãä¿åããã³åé€ããããã®ãã¿ã³
btn_hbox_left = KHBox ïŒ vbox_left ïŒ
save_btn = KPushButton ïŒ btn_hbox_left ïŒ
save_btn setText ïŒ i18n ïŒ 'ä¿å' ïŒ ïŒ
delete_btn = KPushButton ïŒ btn_hbox_left ïŒ
delete_btn ã setText ïŒ i18n ïŒ 'åé€' ïŒ ïŒ
ãããã£ãŠããã®åŸããã©ãŒã ã衚瀺ããããã°ã©ã ããããŸãã
ã€ãã³ãåŠç
次ã«ãããã°ã©ã ã®æ çµã¿ã«åœãå¹ã蟌ãå¿ èŠããããŸãã
ãŠãŒã¶ãŒïŒã€ãŸããIïŒã¯ãã¿ã³ãã¯ãªãã¯ããä¿åããããããã¡ã€ã«ã®ãªã¹ãã§ãããã¡ã€ã«ãéžæããããšã§ãã¹ãŠã®ã¢ã¯ã·ã§ã³ãå®è¡ããããããããã®èŠçŽ ã«ã€ãã³ããã³ãã©ãŒãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã ä¿¡å·ãšã¹ãããã®ã¡ã«ããºã ãããã«åœ¹ç«ã¡ãŸãã
ç°¡åã§ãïŒ
ïŒã€ãã³ããã³ãã©ãŒããã¿ã³ã«ãã€ã³ã
ïŒããã§save_btnã¯ä¿åãã¿ã³ãªããžã§ã¯ããå«ãå€æ°ã§ã
ïŒQtCore.SIGNALïŒ 'clickedïŒïŒ'ïŒ-ããã¿ã³ãã¯ãªãã¯ããšããã·ã°ãã«
ïŒself.onSave-ã¯ãªãã¯ãåŠçããããã«åŒã³åºãããã¡ãœãã
èªå·± ã connect ïŒ save_btn ã QtCoreãSIGNAL ïŒ ' clicked ïŒïŒ' ïŒ ã selfãonSave ïŒ
èªå·± ã connect ïŒ delete_btn ã QtCoreãSIGNAL ïŒ ' clicked ïŒïŒ' ïŒ ã selfãonDelete ïŒ
èªå·± ã connect ïŒ connect_btn ã QtCoreãSIGNAL ïŒ 'clickedïŒïŒ' ïŒ ã selfãonConnect ïŒ
èªå·± ã connect ïŒ disconnect_btn ã QtCoreãSIGNAL ïŒ ' clicked ïŒïŒ' ïŒ ã selfãonDisconnect ïŒ
ïŒæãå°é£ãªããšã¯ãããªã¹ãå ã®ã¢ã€ãã ãã¯ãªãã¯ãããã·ã°ãã«ã®ååãããã¥ã¡ã³ãã§èŠã€ããããšã§ãã
èªå·± ã connect ïŒ selfãsaved_list ã QtCoreãSIGNAL ïŒ 'itemClickedïŒQListWidgetItem *ïŒ' ïŒ ã selfãonSelectServer ïŒ
ãããã¡ã€ã«ãä¿åããŠããŸã
ãã³ãã©ãŒèªäœãäœæããã®ã¯ããªã次第ã§ãã é çªã«å§ããŸãããããããã¡ã€ã«ãä¿åãããããã¡ã€ã«ãåé€ããŸãã
ãããã¡ã€ã«ããŠãŒã¶ãŒã®ããŒã ãã£ã¬ã¯ããªã®ã/ .pyksshfs / hosts /ã«ä¿åããŸãã
ãããã¡ã€ã«ããšã«1ã€ã®ãã¡ã€ã«ãã¡ã€ã«åã¯ããã©ãŒã ã§ãååããšåŒã°ãããã®ã§ãã
èµ·åæã«ãããã°ã©ã ããã®ãããªãã£ã¬ã¯ããªããããã©ããããã§ãã¯ããäžåšã®å Žåã«äœæããå¿ èŠãããã®ã¯è«ççã§ãã
ãããè¡ãã«ã¯ãããã°ã©ã ã®èª¬æã®åŸã«æ¬¡ã®æŽç·ŽãããŠããªãã³ãŒããè¿œå ããŸãã
config_path = os ã getenv ïŒ 'HOME' ïŒ + '/.pyksshfs/hosts'
os㧠ãªã å Žå ã ãã¹ isdir ïŒ config_path ïŒ ïŒ
os ã makedirs ïŒ config_path ã 0700 ïŒ
ãããŠãã€ã³ããŒãOSããã°ã©ã ã§ãã¡ã€ã«ã®å é ã«
ãã©ãŒã ãã£ãŒã«ãã®å€ããã¡ã€ã«ã«ä¿åããæåã®æ¹æ³ãèããŠãç§ã¯ããããPythonã«èšå®ãä¿åããããã®æ¢è£œã®ã¢ãžã¥ãŒã«ããããšæããŸããã ãããŠãããèµ·ãã£ãã
ããããªã°ãŒã°ã«ã§ããã«çµæãåŸãããŸããïŒimport ConfigParser
onSaveã¡ãœããïŒ
def onSave ïŒ self ïŒ ïŒ
'' '
èšå®ãä¿åãã
' ' '
èªå·±ã® å Žå ã entry_name ã text ïŒ ïŒ ïŒ ïŒãããã¡ã€ã«åãããå Žå
config = ConfigParser ã RawConfigParser ïŒ ïŒ ïŒæ§æãäœæããŠå ¥åãã
config add_section ïŒ 'æ¥ç¶' ïŒ
config èšå® ïŒ ãæ¥ç¶ã ã ããã¹ãã ã èªå·± ã ãµãŒããŒã¢ãã¬ã¹ ã ããã¹ã ïŒ ïŒ ïŒ
config èšå® ïŒ ãæ¥ç¶ã ã ãããŒãã ã èªå·± ã ãµãŒã㌠ããŒã ã ããã¹ã ïŒ ïŒ ïŒ
config ã»ãã ïŒ 'Connection' ã 'user_name' ã selfãuser_nameãtext ïŒ ïŒ ïŒ
config set ïŒ 'Connection' ã 'remote_path' ã selfãremote_pathãtext ïŒ ïŒ ïŒ
config set ïŒ 'Connection' ã 'local_path' ã selfãlocal_pathãtext ïŒ ïŒ ïŒ
èªå·±ã® å Žå ã selected_name ïŒ
os ã unlink ïŒ selfãconfig_path + '/' + selfãselected_name ïŒ
path = self config_path + '/' + self entry_name ã ããã¹ã ïŒ ïŒ
ãã¡ã€ã« = ãªãŒãã³ ïŒ ãã¹ ã 'w' ïŒ
config write ïŒ file ïŒ ïŒèšå®ãä¿å
ãã¡ã€ã« ã éãã ïŒ ïŒ
èªå·± ã selected_name = self ã entry_name ã ããã¹ã ïŒ ïŒ
èªå·± ã listServers ïŒ ïŒ ïŒãããã¡ã€ã«ã®ãªã¹ããæŽæ°
ãããã£ãŒã«ãªã¹ã
ã¡ãœããã®èšè¿°ã®æåŸã«ãæ°ãããããã¡ã€ã«ãããã«ãªã¹ãã«è¡šç€ºãããããããšæããŸããããã°ã©ã ãéããšãä¿åããããããã¡ã€ã«ã®ãªã¹ãã衚瀺ããå¿ èŠããããŸãã
ãã®ãããåºåãåä¿¡ããŠââäžèŠ§è¡šç€ºããã¡ãœãããããã«èšè¿°ãã__ init__ããã³onSaveã®æåŸã«åŒã³åºããæ¿å ¥ããŸãã
def listServers ïŒ self ïŒ ïŒ
èªå·± ã saved_list ã ã¯ãªã¢ ïŒ ïŒ
hosts = os listdir ïŒ selfãconfig_path ïŒ
èªå·± ã saved_list ã insertItems ïŒ O ã hosts ïŒ ïŒãã®åŒã³åºãã§ããã¡ã€ã«ã®ãªã¹ãããªã¹ããŠã£ãžã§ããã«è¿œå ããŸã
èªå·±ã® å Žå ã selected_name ïŒ ïŒãã§ã«ãããã¡ã€ã«ãéžæããŠããå Žåã¯ããªã¹ãã§éžæããå¿ èŠããããŸã
item = self saved_list ã findItems ïŒ selfãselected_name ã QtCoreãQtãMatchExactly ïŒ
èªå·± ã saved_list ã setItemSelected ïŒ item [ O ] ã True ïŒ
ïŒäœããã®çç±ã§ãHabrã¯ã³ãŒãã«0ã衚瀺ããããªãããã倧æåã®Oã«çœ®ãæããŸããïŒã
ã¢ã³ããŠã³ã
ããã«é²ã¿ãŸãããã ãªã¢ãŒããã£ã¬ã¯ããªãã¢ã³ããŠã³ãããæ¹æ³ã åºæ¬çã«èª¬æããããšã¯ãããŸããã
def onDisconnect ïŒ self ïŒ ïŒ
if ïŒ selfãlocal_pathãtext ïŒ ïŒ ïŒ ïŒ
os ã system ïŒ 'fusermount -u' + str ïŒ selfãlocal_pathãtext ïŒ ïŒ ïŒ ïŒ
åãä»ã
ããŠã³ãã¯ã¯ããã«èå³æ·±ãã§ãã ç§ã¯ãã®éšåãæãé·ãèŠãããŸããã ãã®æ¹æ³ã®ããã§ã2æé以äžããã£ãã®ã¯ç§å¯ã§ãã ããããå®éã«ã¯ãåé¡ã¯ãã®ãããªæ§è³ªã®ãã®ã§ãã£ãããã以åã«ãããã®ããšãç¥ã£ãŠãããªããèŠåºãã«ç€ºãããæéãå®å šã«æºãããŠããã ããã
åé¡ïŒsshã䜿çšããŠãã£ã¬ã¯ããªãããŠã³ãããã³ãã³ãã¯å¯Ÿè©±åã§ããããŠãŒã¶ãŒããã®ãã¹ã¯ãŒããå¿ èŠã§ãã ãã ããããŒã«ããèªèšŒãè¡ãããå Žåã¯å¿ èŠãããŸããã ãããã£ãŠãã³ãã³ããäœæããå®è¡ãããã¹ã¯ãŒããèŠæ±ãããŠãããã©ããã確èªããŠããããŠãŒã¶ãŒã«èŠæ±ããå¿ èŠããããŸãã ãã¹ã¯ãŒããäžèŠãªå Žåã¯ããŠãŒã¶ãŒã«è§Šããªãã§ãã ããã
sshfsã³ãã³ãã«ã¯ãstdinã§ãã¹ã¯ãŒããæž¡ãããšãã§ãããã©ã¡ãŒã¿ãŒããããŸãã ãã ãããŠãŒã¶ãŒã¯ããã¹ã¯ãŒããäžèŠãªå ŽåãããŸãè¯ããªããã®ãäºåã«å°ããå¿ èŠããããŸãã
å¥ã®åŸ®åŠãªç¹ããããŸãã sshãä»ããŠãµãŒããŒã«ã¢ã¯ã»ã¹ããããšããªãå Žåã¯ãã圌ãä¿¡é ŒããŸããïŒããšå°ããããŸãã
äžè¬ã«ããããã®ã±ãŒã¹ãäœããã®åœ¢ã§åŠçããå¿ èŠããããŸãã ãã®ãããªåé¡ã解決ããããã«ãpexpectã¢ãžã¥ãŒã«ïŒpexpectã®ã€ã³ããŒãïŒããããŸãã ããã䜿çšãããšã察話åããã°ã©ã ïŒtelnetãftpãsshãªã©ïŒã§äœæ¥ã§ããŸãã ããŠãã³ãŒãã衚瀺ããæéã§ãã
def onConnect ïŒ self ïŒ ïŒ
ã³ãã³ã = 'sshfs'
èªå·±ã® å Žå ã user_name ããã¹ã ïŒ ïŒ ïŒ
command + = self user_name ããã¹ã ïŒ ïŒ + '@'
command + = self server_address ã ããã¹ã ïŒ ïŒ
èªå·±ã® å Žå ã remote_path ã ããã¹ã ïŒ ïŒ ïŒ
command + = 'ïŒ' + self remote_path ã ããã¹ã ïŒ ïŒ
ãã®ä» ïŒ
ã³ãã³ã + = 'ïŒ/'
èªå·±ã® å Žå ã server_port ã ããã¹ã ïŒ ïŒ ïŒ
command + = '-p' + self ã server_port ã ããã¹ã ïŒ ïŒ
command + = '' + self ã local_path ã ããã¹ã ïŒ ïŒ
sshfs = pexpect spawn ïŒ str ïŒ command ïŒ ã env = { 'SSH_ASKPASS' ïŒ '/ dev / null' } ïŒ
ssh_newkey = 'æ¥ç¶ãç¶è¡ããŠãããããã§ããïŒ
i = sshfs expect ïŒ [ ssh_newkey ã 'asswordïŒ' ã pexpectãEOF ã pexpectãTIMEOUT ] ïŒ
i = = 0ã® å Žå ïŒ
sshfs sendline ïŒ 'yes' ïŒ
i = sshfs expect ïŒ [ ssh_newkey ã 'asswordïŒ' ã pexpectãEOF ] ïŒ
i = = 1ã® å Žå ïŒ
ïŒãã¹ã¯ãŒããèŠæ±ãããªãå Žå
askpasscmd = 'ksshaskpassïŒ s' ïŒ self entry_name ã ããã¹ã ïŒ ïŒ
ãã¹ã¯ãŒã = pexpect å®è¡ ïŒ askpasscmd ïŒ ã split ïŒ '\ n' ïŒ [ 1 ]
sshfs sendline ïŒ ãã¹ã¯ãŒã ïŒ
j = sshfs expect ïŒ [ pexpectãEOF ã 'asswordïŒ' ] ïŒ
j = = 1ã® å Žå ïŒ
ïŒãã¹ã¯ãŒããæ£ãããããŸããã匷å¶çã«æ¥ç¶ãéããŸã
ããã¹ã¯ãŒããæ£ãããããŸãããã å°å·
sshfs éãã ïŒ True ïŒ
ïŒp.terminateïŒTrueïŒ
elif i = = 2 ïŒ
ïŒãã¹ãŠã®åé¡
print "ãšã©ãŒãèŠã€ãããŸããïŒïŒ s" ïŒ sshfs ã åã«
elif i = = 3 ïŒ
ïŒã¿ã€ã ã¢ãŠã
print "TimeoutïŒïŒ s" ïŒ sshfs ã åã«
sshfsãåºåããŸãã åã«
linux-volume-manager-fuse-kde4ãããžã§ã¯ãããã³ãŒãã®äžéšãåããŸããã æåã¯ç§ã®ã³ãŒãã¯åäœããããããŸããã§ããããã³ãŒããåäœããåŸãç§ã¯ããããã¹ãŠåããŸãŸã«ããããšã«ããŸããã ããå€ãã®ãªãã·ã§ã³ãåŠçããŸãã
ãŠãŒã¶ãŒãããã¹ã¯ãŒããååŸããã«ã¯ãksshaskpassããã°ã©ã ã䜿çšããŸããã 第äžã«ãæžããªãããã«ã第äºã«ã圌女ã¯kwalletdãããã¹ã¯ãŒããä¿å/åä¿¡ããæ¹æ³ãç¥ã£ãŠããŸããããã¯éåžžã«äŸ¿å©ã§ãã
ãªãªãžãã«ã®ã³ãŒãã¯ãksshaskpassã®ããã¥ã¡ã³ãã«ãããšãã¹ã¯ãŒããè¿ãå¿ èŠãããããããŸã£ããæ©èœããŸããã§ãããããã®ä»£ããã«ããã¹ã¯ãŒãã«å ããŠãä»ã®ãããã°è¡ãè¿ããŸãã 圌女ã¯ãã®ããã«é€å€ããªããã°ãªããŸããã§ãã
ãã¹ã¯ãŒã= pexpect.runïŒ 'ksshaskpass'ïŒ.splitïŒ '\ n'ïŒ[1]
ãšããã§ãçªç¶ãããã°è¡ãæ¶ãããšãããã°ã©ã ã¯åäœãåæ¢ããŸãã
ãããã£ãŒã«ã®ã¢ããããŒã
ã»ãšãã©ãã¹ãŠã®æºåãæŽããŸããã æåŸã®ã¢ã¯ã·ã§ã³ã¯æ®ããŸãããŠãŒã¶ãŒããªã¹ãããéžæãããšãã«ãããã¡ã€ã«ãããŒãããŸãã ããã«ã³ãŒãã
def onSelectServer ïŒ self ã item ïŒ ïŒ
ãã ã
seved_listã§ã¢ã€ãã ãéžæãããŠããå Žåããã¡ã€ã«ããèšå®ãååŸ
ã ã
name = item ããã¹ã ïŒ ïŒ ïŒãã¡ã€ã«å
èªå·± ã selected_name = name ïŒéžæãèŠããŠãããŠãã ãã
config = ConfigParser ã RawConfigParser ïŒ ïŒ
config readfp ïŒ open ïŒ selfãconfig_path + '/' + name ïŒ ïŒ ïŒèšå®ãéããŸã
ïŒèšå®ãããã©ãŒã ãã£ãŒã«ãã«å ¥å
èªå·± ã entry_name ã setText ïŒ name ïŒ
èªå·± ã server_address ã setText ïŒ configãget ïŒ 'Connection' ã 'host' ïŒ ïŒ
èªå·± ã server_port ã setText ïŒ configãget ïŒ 'Connection' ã 'port' ïŒ ïŒ
èªå·± ã user_name setText ïŒ configãget ïŒ 'Connection' ã 'user_name' ïŒ ïŒ
èªå·± ã remote_path ã setText ïŒ configãget ïŒ 'Connection' ã 'remote_path' ïŒ ïŒ
èªå·± ã local_path ã setText ïŒ configãget ïŒ 'Connection' ã 'local_path' ïŒ ïŒ
çµæ
以äžã§ãã ã»ãã®2ã3æéã§ãPythonã·ã³ã¿ãã¯ã¹ãã°ãŒã°ã«ããã©ãã¯ãã«ãã®ã¿ã䜿çšããŠãããªãå®çšçãªã³ããŒ/貌ãä»ãããã°ã©ã ãäœæããŸããã
ããããèšäºã§ã¯ãã³ãŒãã®äžéšãèŠéããŠããŸããã
ã§ããããå®å šã«åäœããpyKSshfsããŒãžã§ã³ãããŠã³ããŒãããã®ãæåã§ãã
æåŸã«ã¹ã¯ãªãŒã³ã·ã§ããïŒ
èšç»
ããã°ã©ã ã®äœæã®éäžã§ããã©ãºãã¢ãã¬ãããšããŠãã䟿å©ã«ãªããšæããŸããã ãããŠããã©ãã·ã¥ãã©ã€ããããŠã³ãããããã®ã¢ãã¬ããã®ããã«èŠããã¯ãã§ãã ããããksshaskpassã§å¿ããã£ãã®ã§ã延æããããšã«ããŸããã ãã¶ãããã«ãããã ãŸãã¯å€åããªãã®äžäººãç§ã®å ãè¡ãã§ããã-ç§ã¯ãã ããããã§ãã
åç §è³æ
- pyKSshfsãããŠã³ããŒãããŸã ã
- ãKDE4ã®ããã°ã©ãã³ã°ã
- PyQtããã¥ã¡ã³ã
- Kommanderã¹ã¯ãªããksshfs
- sshfsgui javaããã°ã©ã
- ã³ãŒãã®äžéšã¯ããã§ååŸãããŸããã
ãæž èŽããããšãããããŸããïŒ
ããããã¹ãŠèªãããšãã§ãããã¹ãŠã®äººã®ãããã§ãç§ã¯ãããç°¡åã§ã¯ãªãã£ãããšãç¥ã£ãŠããŸãã =ïŒ
çããã«å¹žéãïŒ