Add entry "Save connection" in File menu
This commit is contained in:
parent
3c4ccb16f9
commit
b548a19e67
1
AUTHORS
1
AUTHORS
@ -16,6 +16,7 @@ Alphabetically:
|
|||||||
|
|
||||||
* Florian Besser (Banton)
|
* Florian Besser (Banton)
|
||||||
* Gryllida A (gry)
|
* Gryllida A (gry)
|
||||||
|
* howaboutudance
|
||||||
|
|
||||||
|
|
||||||
Contact
|
Contact
|
||||||
|
@ -143,3 +143,9 @@ class Network(QtCore.QObject):
|
|||||||
self.status_connecting: 'dialog-close.png',
|
self.status_connecting: 'dialog-close.png',
|
||||||
self.status_connected: 'dialog-ok-apply.png'}
|
self.status_connected: 'dialog-ok-apply.png'}
|
||||||
return icon.get(status, '')
|
return icon.get(status, '')
|
||||||
|
|
||||||
|
def get_options(self):
|
||||||
|
return {'server': self._server,
|
||||||
|
'port': self._port,
|
||||||
|
'ssl': 'on' if self._ssl else 'off',
|
||||||
|
'password': self._password}
|
||||||
|
@ -91,12 +91,13 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
self.statusBar().visible = True
|
self.statusBar().visible = True
|
||||||
|
|
||||||
# actions for menu and toolbar
|
# actions for menu and toolbar
|
||||||
actions_def = {'connect' : ['network-connect.png', 'Connect to WeeChat', 'Ctrl+O', self.open_connection_dialog],
|
actions_def = {'connect' : ['network-connect.png', 'Connect to WeeChat', 'Ctrl+O', self.open_connection_dialog],
|
||||||
'disconnect' : ['network-disconnect.png', 'Disconnect from WeeChat', 'Ctrl+D', self.network.disconnect_weechat],
|
'disconnect' : ['network-disconnect.png', 'Disconnect from WeeChat', 'Ctrl+D', self.network.disconnect_weechat],
|
||||||
'debug' : ['edit-find.png', 'Debug console window', 'Ctrl+B', self.open_debug_dialog],
|
'debug' : ['edit-find.png', 'Debug console window', 'Ctrl+B', self.open_debug_dialog],
|
||||||
'preferences': ['preferences-other.png', 'Preferences', 'Ctrl+P', self.open_preferences_dialog],
|
'preferences' : ['preferences-other.png', 'Preferences', 'Ctrl+P', self.open_preferences_dialog],
|
||||||
'about' : ['help-about.png', 'About', 'Ctrl+H', self.open_about_dialog],
|
'about' : ['help-about.png', 'About', 'Ctrl+H', self.open_about_dialog],
|
||||||
'quit' : ['application-exit.png', 'Quit application', 'Ctrl+Q', self.close],
|
'save connection': ['', 'Save connection configuration', 'Ctrl+S', self.save_connection],
|
||||||
|
'quit' : ['application-exit.png', 'Quit application', 'Ctrl+Q', self.close],
|
||||||
}
|
}
|
||||||
self.actions = {}
|
self.actions = {}
|
||||||
for name, action in list(actions_def.items()):
|
for name, action in list(actions_def.items()):
|
||||||
@ -109,7 +110,7 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
self.menu = self.menuBar()
|
self.menu = self.menuBar()
|
||||||
menu_file = self.menu.addMenu('&File')
|
menu_file = self.menu.addMenu('&File')
|
||||||
menu_file.addActions([self.actions['connect'], self.actions['disconnect'],
|
menu_file.addActions([self.actions['connect'], self.actions['disconnect'],
|
||||||
self.actions['preferences'], self.actions['quit']])
|
self.actions['preferences'], self.actions['save connection'], self.actions['quit']])
|
||||||
menu_window = self.menu.addMenu('&Window')
|
menu_window = self.menu.addMenu('&Window')
|
||||||
menu_window.addAction(self.actions['debug'])
|
menu_window.addAction(self.actions['debug'])
|
||||||
menu_help = self.menu.addMenu('&Help')
|
menu_help = self.menu.addMenu('&Help')
|
||||||
@ -159,6 +160,12 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
def open_preferences_dialog(self):
|
def open_preferences_dialog(self):
|
||||||
pass # TODO
|
pass # TODO
|
||||||
|
|
||||||
|
def save_connection(self):
|
||||||
|
if self.network:
|
||||||
|
options = self.network.get_options()
|
||||||
|
for option in options.keys():
|
||||||
|
self.config.set('relay', option, options[option])
|
||||||
|
|
||||||
def debug_display(self, *args, **kwargs):
|
def debug_display(self, *args, **kwargs):
|
||||||
self.debug_lines.append((args, kwargs))
|
self.debug_lines.append((args, kwargs))
|
||||||
self.debug_lines = self.debug_lines[-DEBUG_NUM_LINES:]
|
self.debug_lines = self.debug_lines[-DEBUG_NUM_LINES:]
|
||||||
|
Loading…
Reference in New Issue
Block a user