def createAP(self, createAp=None): if not self.setting['runningAp'].status['active']: self.setting['runningAp'].activeAp = createAp self.setting['runningAp'].runAp() else: GuiComponent.sendErrorDialog(self.parrent, self._('AP is running'), self._('Before start new one, turn off running AP.')) self.parent.showFirstPage()
def createAP(self, createAp=None): if not self.setting['runningAp'].status['active']: self.setting['runningAp'].activeAp = createAp self.setting['runningAp'].runAp() else: GuiComponent.sendErrorDialog( self.parrent, self._('AP is running'), self._('Before start new one, turn off running AP.')) self.parent.showFirstPage()
def init(self): #language label GuiComponent.createLabel(self._('Language'),[0,1,0,1],self, aligment='right') #init language comboBox self.createLanguageListStore() self.languageComboBox = Gtk.ComboBox.new_with_model(self.languageListStore) defaultPosition = self.setting['language'].getLanguageList().index(self.setting['userSetting'].language['name']) GuiComponent.createComboBox(self.languageComboBox, [1,3,0,1],self , defaultPosition) #Automatic check update GuiComponent.createLabel(self._('Automatic update'),[0,1,1,2],self, aligment='right') GuiComponent.createSwitchButton([2,3,1,2], self, self.automaticCheckUpdate, self.setting['userSetting'].version['autoCheck']) #save GuiComponent.createButton(self._('Save'),[2,3,9,10], self, self.saveSetting)
def elaborationNewApForm(self): if self.apName.get_text() != "": if (len(self.apPassword.get_text()) == 0) or len(self.apPassword.get_text()) >= 8: newApConfiguration = [self.apName.get_text(), self.apPassword.get_text(), GuiComponent.getComboBoxSelect(self.interface1ComboBox),GuiComponent.getComboBoxSelect(self.interface2ComboBox)] self.apName.set_text("") self.apPassword.set_text("") return newApConfiguration else: GuiComponent.sendErrorDialog(self.parent, self._('Invalid password length'), self._('expected length 8..63')) raise ValueError else: GuiComponent.sendErrorDialog(self.parent, self._('Ap name is Empty'), self._('Please fill it.')) raise ValueError
def createAP(self, button=None): if not self.setting['runningAp'].status['active']: createAp = None selection = self.treeview.get_selection() model, paths = selection.get_selected_rows() for path in paths: iter = model.get_iter(path) createAp = self.setting['userSetting'].searchAp(model[iter][0],model[iter][1],model[iter][2]) if createAp != None: self.setting['runningAp'].activeAp = createAp self.setting['runningAp'].runAp() else: GuiComponent.sendErrorDialog(self.parent, self._('AP is running'), self._('Before start new one, turn off running AP.')) self.parent.showFirstPage()
def createAP(self, button=None): if not self.setting['runningAp'].status['active']: createAp = None selection = self.treeview.get_selection() model, paths = selection.get_selected_rows() for path in paths: iter = model.get_iter(path) createAp = self.setting['userSetting'].searchAp( model[iter][0], model[iter][1], model[iter][2]) if createAp != None: self.setting['runningAp'].activeAp = createAp self.setting['runningAp'].runAp() else: GuiComponent.sendErrorDialog( self.parent, self._('AP is running'), self._('Before start new one, turn off running AP.')) self.parent.showFirstPage()
def init(self): self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.setting['userSetting'].getApStore(self.store) self.treeview = Gtk.TreeView(model=self.store) GuiComponent.createTextViewColumn(self.treeview, [self._('AP name'),self._('Interface1'),self._('Interface2')]) scrolled_window = Gtk.ScrolledWindow() scrolled_window.set_policy( Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) scrolled_window.add(self.treeview) #delete AP buton GuiComponent.createButton(self._('Delete'),[1,2,9,10], self, self.deleteAP) #create AP button GuiComponent.createButton(self._('Create'),[2,3,9,10], self, self.createAP) self.attach(scrolled_window, 0, 3, 0, 9)
def init(self): self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) self.setting['userSetting'].getApStore(self.store) self.treeview = Gtk.TreeView(model=self.store) GuiComponent.createTextViewColumn( self.treeview, [self._('AP name'), self._('Interface1'), self._('Interface2')]) scrolled_window = Gtk.ScrolledWindow() scrolled_window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) scrolled_window.add(self.treeview) #delete AP buton GuiComponent.createButton(self._('Delete'), [1, 2, 9, 10], self, self.deleteAP) #create AP button GuiComponent.createButton(self._('Create'), [2, 3, 9, 10], self, self.createAP) self.attach(scrolled_window, 0, 3, 0, 9)
def elaborationNewApForm(self): if self.apName.get_text() != "": if (len(self.apPassword.get_text()) == 0) or len(self.apPassword.get_text()) >= 8: newApConfiguration = [ self.apName.get_text(), self.apPassword.get_text(), GuiComponent.getComboBoxSelect(self.interface1ComboBox), GuiComponent.getComboBoxSelect(self.interface2ComboBox) ] self.apName.set_text("") self.apPassword.set_text("") return newApConfiguration else: GuiComponent.sendErrorDialog(self.parent, self._('Invalid password length'), self._('expected length 8..63')) raise ValueError else: GuiComponent.sendErrorDialog(self.parent, self._('Ap name is Empty'), self._('Please fill it.')) raise ValueError
def saveSetting(self, button=None): self.setting['userSetting'].language['name'] = GuiComponent.getComboBoxSelect(self.languageComboBox) self.setting['language'].update(self.setting) self.setting['userSetting'].save()
def init(self): #status label self.statusTitleLabel = Gtk.Label( self.setting['runningAp'].status['text']) pangoFont = Pango.FontDescription("Sans 40") self.statusTitleLabel.modify_font(pangoFont) self.attach(self.statusTitleLabel, 0, 3, 0, 3) #information about conection #Name GuiComponent.createLabel(self._('AP name'), [0, 1, 3, 4], self, aligment='right') self.statusNameAp = Gtk.Label() GuiComponent.createLabel('None', [1, 3, 3, 4], self, self.statusNameAp, aligment='left') #wifi interface 1 GuiComponent.createLabel(self._('Wifi interface'), [0, 1, 4, 5], self, aligment='right') self.statusInterface1 = Gtk.Label() GuiComponent.createLabel('None', [1, 3, 4, 5], self, self.statusInterface1, aligment='left') #wifi interface 2 GuiComponent.createLabel(self._('Interface with Internet'), [0, 1, 5, 6], self, aligment='right') self.statusInterface2 = Gtk.Label() GuiComponent.createLabel('None', [1, 3, 5, 6], self, self.statusInterface2, aligment='left') #Receiving GuiComponent.createLabel(self._('Receiving'), [0, 1, 6, 7], self, aligment='right') self.statusReciving = Gtk.Label() GuiComponent.createLabel(self._('None'), [1, 2, 6, 7], self, self.statusReciving, aligment='left') #Total Received GuiComponent.createLabel(self._('Total Received'), [0, 1, 7, 8], self, aligment='right') self.statusTotalReciving = Gtk.Label() GuiComponent.createLabel(self._('None'), [1, 2, 7, 8], self, self.statusTotalReciving, aligment='left') #Sending GuiComponent.createLabel(self._('Sending'), [1, 2, 6, 7], self, aligment='right') self.statusSending = Gtk.Label() GuiComponent.createLabel(self._('None'), [2, 3, 6, 7], self, self.statusSending, aligment='left') #Total Sent GuiComponent.createLabel(self._('Total Sent'), [1, 2, 7, 8], self, aligment='right') self.statusTotalSending = Gtk.Label() GuiComponent.createLabel(self._('None'), [2, 3, 7, 8], self, self.statusTotalSending, aligment='left') #connect / disconect button self.errorButton = Gtk.Button() GuiComponent.createButton(self._('Error details'), [2, 3, 9, 10], self, self.errorButtonAction, self.errorButton) #connect / disconect button self.connectButton = Gtk.Button() GuiComponent.createButton(self._('Connect'), [2, 3, 9, 10], self, self.connectButtonAction, self.connectButton) #connect / disconect button self.disconnectButton = Gtk.Button() GuiComponent.createButton(self._('Disconnect'), [2, 3, 9, 10], self, self.disconnectButtonAction, self.disconnectButton)
def errorButtonAction(self, button=None): GuiComponent.sendErrorDialog( self.parent, self.setting['runningAp'].errorMsg['title'], self.setting['runningAp'].errorMsg['text'])
def errorButtonAction(self, button=None): GuiComponent.sendErrorDialog(self.parent, self.setting['runningAp'].errorMsg['title'], self.setting['runningAp'].errorMsg['text'])
def init(self): #status label self.statusTitleLabel = Gtk.Label(self.setting['runningAp'].status['text']) pangoFont = Pango.FontDescription("Sans 40") self.statusTitleLabel.modify_font(pangoFont) self.attach(self.statusTitleLabel, 0,3,0,3) #information about conection #Name GuiComponent.createLabel(self._('AP name'),[0,1,3,4], self, aligment='right') self.statusNameAp = Gtk.Label() GuiComponent.createLabel('None', [1,3,3,4], self, self.statusNameAp, aligment='left') #wifi interface 1 GuiComponent.createLabel(self._('Wifi interface'),[0,1,4,5], self, aligment='right') self.statusInterface1 = Gtk.Label() GuiComponent.createLabel('None', [1,3,4,5], self, self.statusInterface1, aligment='left') #wifi interface 2 GuiComponent.createLabel(self._('Interface with Internet'),[0,1,5,6], self, aligment='right') self.statusInterface2 = Gtk.Label() GuiComponent.createLabel('None', [1,3,5,6], self, self.statusInterface2, aligment='left') #Receiving GuiComponent.createLabel(self._('Receiving'),[0,1,6,7], self, aligment='right') self.statusReciving = Gtk.Label() GuiComponent.createLabel(self._('None'), [1,2,6,7], self, self.statusReciving, aligment='left') #Total Received GuiComponent.createLabel(self._('Total Received'),[0,1,7,8],self, aligment='right') self.statusTotalReciving = Gtk.Label() GuiComponent.createLabel(self._('None'), [1,2,7,8],self, self.statusTotalReciving, aligment='left') #Sending GuiComponent.createLabel(self._('Sending'),[1,2,6,7],self, aligment='right') self.statusSending = Gtk.Label() GuiComponent.createLabel(self._('None'), [2,3,6,7],self, self.statusSending, aligment='left') #Total Sent GuiComponent.createLabel(self._('Total Sent'),[1,2,7,8],self, aligment='right') self.statusTotalSending = Gtk.Label() GuiComponent.createLabel(self._('None'), [2,3,7,8], self, self.statusTotalSending, aligment='left') #connect / disconect button self.errorButton = Gtk.Button() GuiComponent.createButton(self._('Error details'),[2,3,9,10],self,self.errorButtonAction,self.errorButton) #connect / disconect button self.connectButton = Gtk.Button() GuiComponent.createButton(self._('Connect'),[2,3,9,10],self,self.connectButtonAction,self.connectButton) #connect / disconect button self.disconnectButton = Gtk.Button() GuiComponent.createButton(self._('Disconnect'),[2,3,9,10],self,self.disconnectButtonAction,self.disconnectButton)
def init(self): #application name aboutTitleLabel = Gtk.Label(self._('Create AP Gui')) pangoFont = Pango.FontDescription("Sans 40") aboutTitleLabel.modify_font(pangoFont) self.attach(aboutTitleLabel, 0,3,0,2) #Description GuiComponent.createLabel(self._('\t Gui application for easy creating access points.\n Application allows save configuration for quickly create AP.'),[0,3,2,3],self, aligment='center') #version GuiComponent.createLabel(self._('Version:'),[0,1,3,4],self, aligment='right') GuiComponent.createLabel(__version__,[1,3,3,4],self, aligment='left') #author GuiComponent.createLabel(self._('Author:'),[0,1,4,5],self, aligment='right') GuiComponent.createLabel(self._('Jakub Pelikan'),[1,3,4,5],self, aligment='left') #nick GuiComponent.createLabel(self._('Nick:'),[0,1,5,6],self, aligment='right') GuiComponent.createLabel(self._('P-eli'),[1,3,5,6],self, aligment='left') #email GuiComponent.createLabel(self._('Email:'),[0,1,6,7],self, aligment='right') GuiComponent.createLabel(self._('*****@*****.**'),[1,3,6,7],self, aligment='left') #Website GuiComponent.createLabel(self._('Website:'),[0,1,7,8],self, aligment='right') website = Gtk.Label() GuiComponent.createLabel('',[1,3,7,8],self,website, aligment='left') website.set_markup("<a href=\"http://github.com/p-eli/create_ap-gui\" " "title=\"Click to open website\">http://github.com/p-eli/create_ap-gui</a>") GuiComponent.createLabel('',[0,1,8,9],self, aligment='right') GuiComponent.createLabel('',[0,1,9,10],self, aligment='right')
def init(self): self.refreshingInterface = False self.interfaceListSignal = GObject.GObject() self.interfaceListSignal.connect('interfaceListMsg', self.readInterfaceList) self.initInterfaceList() #create New Form #acces point name GuiComponent.createLabel(self._('AP name'), [0, 1, 0, 1], self, aligment='right') #access point name set text self.apName = Gtk.Entry() GuiComponent.createEntry(self.apName, [1, 3, 0, 1], self, "") #acces point password GuiComponent.createLabel(self._('Password'), [0, 1, 1, 2], self, aligment='right') #access point password set text self.apPassword = Gtk.Entry() GuiComponent.createEntry(self.apPassword, [1, 3, 1, 2], self, "", False) #Show password self.showPassword = Gtk.CheckButton(self._("Show password"), self) GuiComponent.createCheckButton(self.showPassword, [1, 3, 2, 3], self, self.showHidePasswd, True) #wifi interface label GuiComponent.createLabel(self._('Wifi interface'), [0, 1, 3, 4], self, aligment='right') #wifi interface Combobox self.interface1ComboBox = Gtk.ComboBox.new_with_model( self.interfaceListStore) GuiComponent.createComboBox(self.interface1ComboBox, [1, 3, 3, 4], self, None) #interface with internet Label GuiComponent.createLabel(self._('Interface with Internet'), [0, 1, 4, 5], self, aligment='right') #interface with internet Combobox self.interface2ComboBox = Gtk.ComboBox.new_with_model( self.interfaceListStore) GuiComponent.createComboBox(self.interface2ComboBox, [1, 3, 4, 5], self, None) #refresh interface list button GuiComponent.createButton(self._('Refresh'), [2, 3, 5, 6], self, self.refreshInterfaceList) #Save and Create AP GuiComponent.createButton(self._("Only Create"), [1, 2, 9, 10], self, self.onlyCreateAction) GuiComponent.createButton(self._("Save and Create"), [2, 3, 9, 10], self, self.saveCreateAction)
def init(self): self.refreshingInterface = False self.interfaceListSignal = GObject.GObject() self.interfaceListSignal.connect('interfaceListMsg', self.readInterfaceList) self.initInterfaceList() #create New Form #acces point name GuiComponent.createLabel(self._('AP name'),[0,1,0,1], self, aligment='right') #access point name set text self.apName = Gtk.Entry() GuiComponent.createEntry(self.apName, [1,3,0,1],self, "") #acces point password GuiComponent.createLabel(self._('Password'),[0,1,1,2],self, aligment='right') #access point password set text self.apPassword = Gtk.Entry() GuiComponent.createEntry(self.apPassword, [1,3,1,2],self,"",False) #Show password self.showPassword = Gtk.CheckButton(self._("Show password"),self) GuiComponent.createCheckButton(self.showPassword, [1,3,2,3],self , self.showHidePasswd, True) #wifi interface label GuiComponent.createLabel(self._('Wifi interface'),[0,1,3,4],self, aligment='right') #wifi interface Combobox self.interface1ComboBox = Gtk.ComboBox.new_with_model(self.interfaceListStore) GuiComponent.createComboBox(self.interface1ComboBox, [1,3,3,4],self , None) #interface with internet Label GuiComponent.createLabel(self._('Interface with Internet'),[0,1,4,5],self, aligment='right') #interface with internet Combobox self.interface2ComboBox = Gtk.ComboBox.new_with_model(self.interfaceListStore) GuiComponent.createComboBox( self.interface2ComboBox, [1,3,4,5], self, None) #refresh interface list button GuiComponent.createButton(self._('Refresh'),[2,3,5,6], self, self.refreshInterfaceList) #Save and Create AP GuiComponent.createButton(self._("Only Create"), [1,2,9,10], self, self.onlyCreateAction) GuiComponent.createButton(self._("Save and Create"), [2,3,9,10], self, self.saveCreateAction)