def add_new_robot(self, name): """ this Function adds a new robot to the View, creates the nessesary widgets and register the observers :param robot: Name of the Robot :type name: String """ builder_int = gtk.Builder() builder_int.add_objects_from_file( find("Projekt_DebugUI_Motor_View.glade"), ("MotorView",)) motor_view_int = builder_int.get_object('MotorView') for i in range(1, 21): motor = builder_int.get_object('motor' + str(i)) print motor motor.set_name("%02d%s" % (i, name)) cm = builder_int.get_object('volt_cm730') cm.set_name("cm%s" % name) builder_ext = gtk.Builder() builder_ext.add_objects_from_file( find("Projekt_DebugUI_Motor_View.glade"), ("MotorView",)) motor_view_ext = builder_ext.get_object('MotorView') self.last_update_label[name + "_int" ] = builder_int.get_object( "lastUpdate") self.last_update_label[name + "_ext" ] = builder_ext.get_object( "lastUpdate") self.last_update[name + '_int'] = 0 self.last_update[name + '_ext'] = 0 gobject.timeout_add(1000, self.update_last_update_label, name + "_int") gobject.timeout_add(1000, self.update_last_update_label, name + "_ext") self.add_notebook_page(name, motor_view_int, motor_view_ext) self.motorviews[name + "_int"] = make_ui_proxy(builder_int) self.motorviews[name + "_ext"] = make_ui_proxy(builder_ext) self.register_observers(name, self.data_callback) self.robots.append(name) builder_int.connect_signals(self) builder_ext.connect_signals(self) self.motortmps[name] = {} self.voltage[name] = [[], []]
def on_imageMenuItemPreferences_activate(self, *args): """ Opens the window for changing preferences. """ self.builderPref = gtk.Builder() self.builderPref.add_from_file(find("Projekt_DebugUI_Einstellungenfenster.glade")) self.Pref = self.builderPref.get_object("windowEinstellungen") self.builderPref.connect_signals(self) print ("Preferences-Fenster wurde erstellt") self.Pref.show()
def on_imageMenuItemSpeichernUnter_activate(self, *args): """ Opens the 'Save as'-filechooser. """ self.builderFilChoSav = gtk.Builder() self.builderFilChoSav.add_from_file(find("Projekt_DebugUI_FilechooserSpeichernUnter.glade")) self.filChoSav = self.builderFilChoSav.get_object("filechooserdialogSpeichernUnter") self.builderFilChoSav.connect_signals(self) print ("SpeichernUnter-Filechooser wurde erstellt") self.filChoSav.show()
def on_imageMenuItemOeffnen_activate(self, *args): """ Opens the 'Open'-filechooser. """ self.builderFilChoOp = gtk.Builder() self.builderFilChoOp.add_from_file(find("Projekt_DebugUI_FilechooserOeffnen.glade")) self.filChoOp = self.builderFilChoOp.get_object("filechooserdialogOeffnen") self.builderFilChoOp.connect_signals(self) print ("Oeffnen-Filechooser wurde erstellt") self.filChoOp.show()
def __init__(self): self.builderWwin = gtk.Builder() self.builderWwin.add_from_file( find("Projekt_DebugUI_Warnfenster.glade")) #das Warnfenster. muss eigentlich bei Fehlern aufgerufen werden #sobald die Errorbits funzen kann also das Warnfenster zusammen mit einem auftretenden #Fehler aufgerufen werden self.wWindow = self.builderWwin.get_object( "messagedialogWarnfenster") self.builderWwin.connect_signals(self)
def setup_ui(self): """ Sets up the UI. Loads all files necessary to set up the individual Views For Testing purposes Only: Pops up the warning window, when the UI is started. """ self.builderMainWin = gtk.Builder() self.builderConfWin = gtk.Builder() self.builderMainWin.add_from_file(find("Projekt_DebugUI_MainWindow.glade")) self.builderConfWin.add_from_file(find("Projekt_DebugUI_Confirmation.glade")) # die externe Nachrichtensicht self.builderNewsExt = gtk.Builder() self.builderNewsExt.add_from_file(find("Projekt_DebugUI_NewsExt.glade")) # die externe Roboauswahlsicht self.builderRoboSel = gtk.Builder() self.builderRoboSel.add_from_file(find("Projekt_DebugUI_RoboSelect.glade")) # das Aboutfenster self.builderAboutView = gtk.Builder() self.builderAboutView.add_from_file(find("Projekt_DebugUI_Aboutfenster2.glade")) self.aboutD = self.builderAboutView.get_object("Aboutfenster") ##die externe Kamerasicht # self.builderCameraView = gtk.Builder() # self.builderCameraView.add_from_file(find("debug-ui-neu/Projekt_DebugUI_CameraView.glade")) self.mainwindow = self.builderMainWin.get_object("mainWindowDebugUI") self.confWin = self.builderConfWin.get_object("messagedialogQuitConf") # Views anzeigen # TODO: das will vielleicht dynamischer werden self.builderMainWin.get_object("Content1").add(self.views[0]) self.builderMainWin.get_object("Content3").add(self.views[1]) self.builderMainWin.get_object("Content2").add(self.views[2]) self.viewslots_oben = [] self.viewslots_unten = [] self.viewslots_oben.append(self.builderMainWin.get_object("Content1")) self.viewslots_oben.append(self.builderMainWin.get_object("Content2")) self.viewslots_unten.append(self.builderMainWin.get_object("Content3")) self.mainwindow.show_all() # self.imageViewFrame = self.builderMainWin.get_object("frameImageview") # self.imageFrame1 = self.builderMainWin.get_object("frame1") # fenster für values anlegen, aber nicht zeigen self.RoboSel = self.builderRoboSel.get_object("RoboSelectExtern") self.builderRoboSel.connect_signals(self) # fenster für externe LogView self.NewsExt = self.builderNewsExt.get_object("NewsExtern") self.builderNewsExt.connect_signals(self) # self.make_view(name, imageViewFrame) # self.me_show.show() # self.store = DataStore() self.debug_plain_dumper = DebugPlainDumper() # Automatische Verbindung der in Glade festgelegten Signals mit ihren Handlern. self.builderMainWin.connect_signals(self) self.builderConfWin.connect_signals(self) self.builderAboutView.connect_signals(self)