Ejemplo n.º 1
0
    def __init__(self, initmsg=None, others=[]):
        super(StatusBar, self).__init__()
        self._context = self.get_context_id("unique_sb")
        self._active_counter = 0

        # add the others
        for oth in others[::-1]:
            self.pack_end(oth, False)
            self.pack_end(gtk.VSeparator(), False)

        if initmsg is not None:
            self.__call__(initmsg)

        self.show_all()
Ejemplo n.º 2
0
    def BuildStatTable(self,char):
        """ Clears out and constructs the Stat table on the Overview tab. """
        #Clear it.
        self.statWidgets = {}
        stTable = self['statTable']
        for ch in stTable.get_children():
            stTable.remove(ch)

        #Set up the overall structure.
        length = sum(1 for _ in char.Stats)
        linesPerDivide = 5
        tableSize = 2 + length + length/linesPerDivide - (1 if length%linesPerDivide==0 else 0)
        stTable.resize(tableSize,5)
        stTable.attach(gtk.Label('Temp'),2,3,0,1)
        stTable.attach(gtk.Label('Bonus'),4,5,0,1)
        stTable.attach(gtk.HSeparator(),0,5,1,2)
        stTable.attach(gtk.VSeparator(),1,2,0,tableSize)
        stTable.attach(gtk.VSeparator(),3,4,0,tableSize)
        offset = 2

        #import code; code.interact(local=locals())

        #Add stat information
        for i,st in enumerate(char.Stats):
            loc = i + offset
            nameLabel = gtk.Label(st.Name)
            nameLabel.set_alignment(1.0,0.5)
            stTable.attach(nameLabel,0,1,loc,loc+1)
            tempWid = gtk.Label(str(st.Value))
            stTable.attach(tempWid,2,3,loc,loc+1)
            bonusWid = gtk.Label(str(st.Bonus()))
            stTable.attach(bonusWid,4,5,loc,loc+1)
            self.statWidgets[st.Name] = (tempWid,bonusWid)
            if (i+1) % linesPerDivide == 0 and loc+1!=tableSize:
                stTable.attach(gtk.HSeparator(),0,5,loc+1,loc+2)
                offset += 1
        stTable.show_all()
def buttons1():

    globals()["toppannelbox"] = gtk.HBox(False)
    mainbox.pack_start(toppannelbox, False)
    mainbox.pack_start(gtk.HSeparator(), False)

    # open project folder

    projectfolder = gtk.Button()
    projectfolder.props.relief = gtk.RELIEF_NONE
    projectfolbox = gtk.HBox(False)
    projectfolico = gtk.Image()
    projectfolico.set_from_file("py_data/icons/folder.png")
    projectfolbox.pack_start(projectfolico, False)
    projectfolbox.pack_start(gtk.Label("  Project"))
    projectfolder.add(projectfolbox)
    projectfolder.set_tooltip_text("Open the " + os.getcwd())

    def openpf(w=None):
        oscalls.Open(os.getcwd())

    projectfolder.connect("clicked", openpf)

    toppannelbox.pack_start(projectfolder, False)

    # open rnd folder

    rndfolder = gtk.Button()
    rndfolder.props.relief = gtk.RELIEF_NONE
    rndfolbox = gtk.HBox(False)
    rndfolico = gtk.Image()
    rndfolico.set_from_file("py_data/icons/folder.png")
    rndfolbox.pack_start(rndfolico, False)
    rndfolbox.pack_start(gtk.Label("  Renders"))
    rndfolder.add(rndfolbox)
    rndfolder.set_tooltip_text("Open the " + os.getcwd() + "/rnd")

    def openpf(w=None):
        oscalls.Open(os.getcwd() + "/rnd")

    rndfolder.connect("clicked", openpf)

    #toppannelbox.pack_start(rndfolder, False)
    toppannelbox.pack_start(gtk.VSeparator(), False)

    #### OLD STYLE ELEMENTS BUTTONS WITH A TWIST

    mainbuttonsbox = gtk.HBox()
    toppannelbox.pack_start(mainbuttonsbox, False)
Ejemplo n.º 4
0
	def init_layout(self):
		"""initializes the layout of the user interface
		@note: make shure to call this method after intitializing the user inteface
		"""
		# layout splitter. directoryList + buttons | logWidget
		self.pack_start(self.splitter)
		frame = gtk.Frame()
		frame.set_shadow_type(gtk.SHADOW_IN)
		box1 = gtk.VBox()
		frame.add(box1)
		self.splitter.pack1(frame, resize=True, shrink=False)
		box2 = gtk.HBox()
		box1.pack_start(self.directoryListScroll)
		box1.pack_start(box2, expand=False)
		box2.pack_start(self.buttonNew)
		box2.pack_start(self.buttonEdit)
		box2.pack_start(self.buttonUp)
		box2.pack_start(self.buttonDown)
		box2.pack_start(self.buttonRemove)
		self.logView.set_shadow_type(gtk.SHADOW_IN)
		self.splitter.pack2(self.logView, resize=True, shrink=False)

		self.pack_start(self.buttonImport, expand=False)

		# layout first column of settings widgets
		box2 = gtk.HBox()
		self.pack_start(box2, expand=False)
		box3 = gtk.VBox()
		box2.pack_start(box3)
		box3.pack_start(self.checkAutoStartImport)
		box3.pack_start(self.checkAppendMessages)

		box2.pack_start(gtk.VSeparator())

		# layout secund column of settings widgets
		#TODO: layout is a bit messy here with labels + spinboxes
		# have not found a way to properly align labes / boxes yet
		box3 = gtk.VBox()
		box2.pack_start(box3)
		box4 = gtk.HBox()
		box3.pack_start(box4)
		box4.pack_start(self.labelImportTimeout, expand=False)
		box4.pack_start(self.spinImportTimeout)
		box4 = gtk.HBox()
		box3.pack_start(box4)
		box4.pack_start(self.labelMaxLogLines, expand=False)
		box4.pack_start(self.spinMaxLogLines)

		self.show_all()
Ejemplo n.º 5
0
    def __init__(self, canvas):
        gtk.HBox.__init__(self)

        self.canvas = canvas

        button = gtk.Button()
        button.set_relief(gtk.RELIEF_NONE)
        self.add(button)

        image = gtk.Image()
        image.set_from_stock(gtk.STOCK_ZOOM_OUT, gtk.ICON_SIZE_MENU)
        button.connect("clicked", self.zoom_out)
        button.add(image)

        self.button = gtk.Button('1.00 (100%)')
        self.button.set_relief(gtk.RELIEF_NONE)
        #self.button.connect("clicked", self.custom_zoom)
        self.add(self.button)

        button = gtk.Button()
        button.set_relief(gtk.RELIEF_NONE)
        self.add(button)

        image = gtk.Image()
        image.set_from_stock(gtk.STOCK_ZOOM_IN, gtk.ICON_SIZE_MENU)
        button.connect("clicked", self.zoom_in)
        button.add(image)

        separator = gtk.VSeparator()
        self.add(separator)

        button = gtk.Button()
        button.set_relief(gtk.RELIEF_NONE)
        self.add(button)

        image = gtk.Image()
        image.set_from_stock(gtk.STOCK_ZOOM_FIT, gtk.ICON_SIZE_MENU)
        #button.connect("clicked", self.zoom_fit)
        button.add(image)

        button = gtk.Button()
        button.set_relief(gtk.RELIEF_NONE)
        self.add(button)

        image = gtk.Image()
        image.set_from_stock(gtk.STOCK_ZOOM_100, gtk.ICON_SIZE_MENU)
        button.connect("clicked", self.zoom_normal)
        button.add(image)
Ejemplo n.º 6
0
    def add_text(self, data_dict, version):
        '''data_dict ontains text to be added.
           Key will be the title
           Value will be... well, the value :)'''
        self.box = gtk.HBox(False, 1)
        self._statusbar.pack_start(self.box, False, False, 1)
        ellipsize = pango.ELLIPSIZE_NONE
        for element in data_dict.keys():
            # Element icon
            if element == 'processor':
                _icon = gtk.image_new_from_file(
                    os.path.dirname(__file__) + os.sep + 'data' + os.sep +
                    'processor_small.png')
                self.box.pack_start(_icon, False, False, 0)
            else:
                _icon = gtk.image_new_from_stock(self.icons[element],
                                                 gtk.ICON_SIZE_MENU)
                self.box.pack_start(_icon, False, False, 0)
            # Element label
            label = gtk.Label()
            label.set_markup('<b>' + element.capitalize() + ':</b>')
            label.set_padding(1, 5)
            label.set_max_width_chars(len(element) + 1)
            label.set_single_line_mode(True)
            label.set_ellipsize(ellipsize)
            self.box.pack_start(label, True, True, 1)
            # Element content
            label = gtk.Label(str(data_dict[element]))
            label.set_padding(1, 5)
            label.set_max_width_chars(len(str(data_dict[element])))
            label.set_single_line_mode(True)
            label.set_ellipsize(ellipsize)
            self.box.pack_start(label, True, True, 1)
            sep = gtk.VSeparator()
            self.box.pack_start(sep, True, True, 1)

        if version:
            _icon = gtk.image_new_from_file(
                os.path.dirname(__file__) + os.sep + 'data' + os.sep +
                'bokken-small.svg')
            self.pack_start(_icon, False, False, 1)
            label = gtk.Label()
            label.set_markup('<b>Bokken ' + version + '</b> (' +
                             self.uicore.backend.capitalize() + ')')
            label.set_padding(3, 3)
            self.pack_end(label, False)

        self.show_all()
Ejemplo n.º 7
0
    def __init__(self, teacher):
        abstract.Gui.__init__(self, teacher)
        self.m_key_bindings = {'backspace_ak': self.on_backspace}
        self.g_answer_box = gu.NewLineBox()
        self.practise_box.pack_start(self.g_answer_box, False)
        #-------
        hbox = gu.bHBox(self.practise_box)
        b = gtk.Button(_("Play"))
        b.show()
        b.connect('clicked', self.play_users_answer)
        hbox.pack_start(b, False, True)
        self.practise_box.pack_start(gtk.HBox(), False, padding=gu.PAD_SMALL)
        self.g_rhythm_viewer = RhythmViewer(self)
        #FIXME the value 52 is dependant on the theme used
        self.g_rhythm_viewer.set_size_request(-1, 52)
        self.g_rhythm_viewer.create_holders()
        hbox.pack_start(self.g_rhythm_viewer)
        #self.practise_box.pack_start(self.g_rhythm_viewer, False)

        # action area
        self.std_buttons_add(
            ('new', self.new_question), ('repeat', self.repeat_question),
            ('give_up', self.give_up), ('backspace', self.on_backspace))

        self.practise_box.show_all()
        ##############
        # config_box #
        ##############
        self.add_select_elements_gui()
        #--------
        self.config_box.pack_start(gtk.HBox(), False, padding=gu.PAD_SMALL)
        self.add_select_num_beats_gui()
        #-----
        self.config_box.pack_start(gtk.HBox(), False, padding=gu.PAD_SMALL)
        #------
        hbox = gu.bHBox(self.config_box, False)
        hbox.set_spacing(gu.PAD_SMALL)
        hbox.pack_start(
            gu.nCheckButton(self.m_exname, "not_start_with_rest",
                            _("Don't start the question with a rest")), False)
        sep = gtk.VSeparator()
        hbox.pack_start(sep, False)
        hbox.pack_start(gtk.Label(_("Beats per minute:")), False)
        spin = gu.nSpinButton(self.m_exname, 'bpm',
                              gtk.Adjustment(60, 20, 240, 1, 10))
        hbox.pack_start(spin, False)
        self._add_auto_new_question_gui(self.config_box)
        self.config_box.show_all()
Ejemplo n.º 8
0
    def add_status(self, name, widget, text='', expand=False):
        #widget.set_text(text)
        separator = gtk.VSeparator()

        # add in ui
        if self._places:
            self._statusbar.pack_start(separator, expand=False)
        self._statusbar.pack_start(widget, expand=expand, padding=5)
        if self.opt('show_statusbar'):
            self._statusbar.show_all()

        # save in cache
        self._places[name] = {
            'widget': widget,
            '_separator': separator,
        }
Ejemplo n.º 9
0
 def _generate_message_widget(self):
     # Generate the message display widget.
     self._message_widget = gtk.EventBox()
     self._message_widget.show()
     message_hbox = gtk.HBox()
     message_hbox.show()
     self._message_widget.add(message_hbox)
     self._message_widget.connect("enter-notify-event",
                                  self._handle_enter_message_widget)
     self._message_widget_error_image = gtk.image_new_from_stock(
         gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_MENU)
     self._message_widget_info_image = gtk.image_new_from_stock(
         gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_MENU)
     self._message_widget_label = gtk.Label()
     self._message_widget_label.show()
     vsep = gtk.VSeparator()
     vsep.show()
     self._console_launcher = rose.gtk.util.CustomButton(
         stock_id=gtk.STOCK_INFO,
         size=gtk.ICON_SIZE_MENU,
         tip_text=rose.config_editor.STATUS_BAR_CONSOLE_TIP,
         as_tool=True)
     self._console_launcher.connect("clicked", self._launch_console)
     style = gtk.RcStyle()
     style.xthickness = 0
     style.ythickness = 0
     setattr(style, "inner-border", [0, 0, 0, 0])
     self._console_launcher.modify_style(style)
     message_hbox.pack_start(self._message_widget_error_image,
                             expand=False,
                             fill=False)
     message_hbox.pack_start(self._message_widget_info_image,
                             expand=False,
                             fill=False)
     message_hbox.pack_start(self._message_widget_label,
                             expand=False,
                             fill=False,
                             padding=rose.config_editor.SPACING_SUB_PAGE)
     message_hbox.pack_start(vsep,
                             expand=False,
                             fill=False,
                             padding=rose.config_editor.SPACING_SUB_PAGE)
     message_hbox.pack_start(self._console_launcher,
                             expand=False,
                             fill=False)
Ejemplo n.º 10
0
    def __init__(self, emma):
        """
        @param emma: Emma
        """
        super(TabBlobView, self).__init__()

        self.emma = emma

        hbox = gtk.HBox()
        hbox.set_spacing(5)

        self.blob_wrap_check = gtk.CheckButton('Wrap Text')
        self.blob_wrap_check.connect('clicked',
                                     self.on_blob_wrap_check_clicked)
        hbox.pack_start(self.blob_wrap_check, False, True)

        self.blob_update = gtk.Button('Update', gtk.STOCK_REFRESH)
        self.blob_update.connect('clicked', self.on_blob_update_clicked)
        hbox.pack_start(self.blob_update, False, True)

        hbox.pack_start(gtk.VSeparator(), False, True)

        self.blob_save = gtk.Button('Save', gtk.STOCK_SAVE)
        self.blob_save.connect('clicked', self.on_blob_save_clicked)
        hbox.pack_start(self.blob_save, False, True)

        self.blob_load = gtk.Button('Load', gtk.STOCK_OPEN)
        self.blob_load.connect('clicked', self.on_blob_load_clicked)
        hbox.pack_start(self.blob_load, False, True)

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.tv = gtk.TextView()
        self.tv.set_editable(False)
        self.tv.set_sensitive(False)
        sw.add(self.tv)

        self.pack_start(hbox, False, True)
        self.pack_end(sw, True, True)

        self.buffer = self.tv.get_buffer()
        self.visible = False
        self.encoding = None

        self.show_all()
Ejemplo n.º 11
0
    def __assemble_advanced(self):

        adv_row = gtk.HBox(0, 0)

        desc_b = gtk.CheckButton(_("Search descriptions"))
        desc_b.set_active(1)
        adv_row.pack_start(desc_b, expand=0, fill=0, padding=0)

        desc_b.connect("toggled", lambda b, sbox: sbox.__changed(), self)

        self.__search_desc = desc_b

        ###
        ### Match radio buttons
        ###

        match_label = gtk.Label(_("Match:"))

        any_all = self.__assemble_any_or_all_option_menu()
        whole_substr = self.__assemble_whole_or_substr_option_menu()

        match_box = gtk.HBox(0, 0)
        match_box.pack_start(match_label, padding=2)
        match_box.pack_start(any_all)
        match_box.pack_start(gtk.VSeparator(), padding=5)
        match_box.pack_start(whole_substr)
        match_box.show_all()

        adv_row.pack_end(match_box, expand=0, fill=0, padding=0)

        adv_row.show_all()
        adv_row.hide()
        if show_advanced_get():
            adv_row.show()

        def showadv_cb(sa, flag, w):
            if flag:
                w.show()
            else:
                w.hide()

        _showadv.connect("changed", showadv_cb, adv_row)

        return adv_row
Ejemplo n.º 12
0
 def build_action_box(self, obj_evt):
     # build the widget to present an event :
     # tooltip with event infos
     # image containing snapshot of the event
     # label with the time of the event
     act = obj_evt.name
     act_begin = time.strftime("%H:%M:%S", time.localtime(obj_evt.time[0]))
     if self.options['time'] == 'activity':
         act_begin = helper.format_time_reference(obj_evt.activity_time[0])
     entetestr = "%s : %s" % (act_begin, act)
     corpsstr = ""
     for op in obj_evt.operations:
         op_time = time.strftime("%H:%M:%S", time.localtime(op.time))
         if self.options['time'] == 'activity':
             op_time = helper.format_time_reference(op.activity_time)
         if op.concerned_object['name'] is None:
             corpsstr += urllib.unquote( op_time + " : " + op.name + "\n")
         else:
             corpsstr += urllib.unquote( op_time + " : " + op.name + " ( " + op.concerned_object['name'] + " : " + op.concerned_object['id'] + " )\n")
     entete = gtk.Label(entetestr.encode("UTF-8"))
     hb = gtk.HBox()
     box = gtk.EventBox()
     tr = TimestampRepresentation(obj_evt.movietime, self.controller, 50, 0, None , False)
     if tr is not None:
         hb.pack_start(tr, expand=False)
         hb.pack_start(gtk.VSeparator(), expand=False)
     if corpsstr != "":
         hb.set_tooltip_text(corpsstr)
     def box_pressed(w, event, ops):
         if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
             #FIXME : need to change details in another way
             self.filters['objects']=[]
             self.filters['objects'].extend(ops)
             self.options['detail']='operations'
             self.DetB.set_label('operations')
             #FIXME color change of the reset button when applying a filter
             self.filter_active(True)
             self.receive(self.tracer.trace)
         return
     box.add(entete)
     box.connect('button-press-event', box_pressed, obj_evt.operations)
     hb.pack_start(box, expand=False)
     return hb
Ejemplo n.º 13
0
    def __init__(self, window, parent, model, attrs={}):
        interface.widget_interface.__init__(self, window, parent, model, attrs)

        self.widget = gtk.VBox(homogeneous=False, spacing=1)

        hb = gtk.HBox(homogeneous=False, spacing=3)
        self.wid_text = gtk.Entry()
        self.wid_text.set_property('width_chars', 13)
        self.wid_text.connect('activate', self._sig_activate)
        self.wid_text.connect('button_press_event', self._menu_open)
        hb.pack_start(self.wid_text, expand=True, fill=True)

        hb.pack_start(gtk.VSeparator(), padding=2, expand=False, fill=False)

        self.wid_but_add = gtk.Button(stock='gtk-add')
        self.wid_but_add.set_relief(gtk.RELIEF_HALF)
        self.wid_but_add.set_focus_on_click(True)
        self.wid_but_add.connect('clicked', self._sig_add)
        hb.pack_start(self.wid_but_add, padding=3, expand=False, fill=False)

        self.wid_but_remove = gtk.Button(stock='gtk-remove')
        self.wid_but_remove.set_relief(gtk.RELIEF_HALF)
        self.wid_but_remove.set_focus_on_click(True)
        self.wid_but_remove.connect('clicked', self._sig_remove)
        hb.pack_start(self.wid_but_remove, expand=False, fill=False)

        self.widget.pack_start(hb, expand=False, fill=False)
        self.widget.pack_start(gtk.HSeparator(), expand=False, fill=True)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.set_placement(gtk.CORNER_TOP_LEFT)
        scroll.set_shadow_type(gtk.SHADOW_NONE)

        self.screen = Screen(attrs['relation'],
                             view_type=['tree'],
                             views_preload=attrs.get('views', {}))
        scroll.add_with_viewport(self.screen.widget)
        self.widget.pack_start(scroll, expand=True, fill=True)

        #        self.old = None
        self.avail_ids = set()
Ejemplo n.º 14
0
 def build_eqnTable(self):
     debug.mainthreadTest()
     self.eqntable.foreach(gtk.Object.destroy)  # clear the table
     self.eqnbuttons = {}
     eqlist = equation.allEquations
     self.eqntable.resize(len(eqlist), 3)
     row = 0
     for eqn in eqlist:
         label = gtk.Label(utils.underscore2space(eqn.name()))
         label.set_alignment(1.0, 0.5)
         self.eqntable.attach(label,
                              0,
                              1,
                              row,
                              row + 1,
                              xoptions=gtk.FILL,
                              yoptions=0)
         button = gtk.CheckButton('active')
         gtklogger.setWidgetName(button, eqn.name() + " active")
         signal = gtklogger.connect(button, 'clicked', self.eqnButtonCB,
                                    eqn)
         self.eqnbuttons[(eqn.name(),
                          "active")] = ButtonSignal(button, signal)
         tooltips.set_tooltip_text(button,
                                   'Active equations will be solved.')
         self.eqntable.attach(button,
                              2,
                              3,
                              row,
                              row + 1,
                              xoptions=0,
                              yoptions=0)
         row += 1
     self.eqntable.attach(gtk.VSeparator(),
                          1,
                          2,
                          0,
                          len(eqlist),
                          xoptions=0,
                          yoptions=gtk.EXPAND | gtk.FILL)
     self.eqntable.set_col_spacing(0, 3)
Ejemplo n.º 15
0
    def insert_bokken_text(self, data_dict, version):
        '''data_dict ontains text to be added.
           Key will be the title
           Value will be... well, the value :)'''

        context = self.ing.bokken_sb.get_context_id('sb')
        self.text = ''
        for element in data_dict.keys():
            self.text += element.capitalize() + ': ' + str(
                data_dict[element]) + ' | '
        self.ing.bokken_sb.push(context, self.text)
        if version:
            self.icon = gtk.Image()
            pixbuf = gtk.gdk.pixbuf_new_from_file(
                'lib/ui/bokken/data/icon.png')
            scaled_buf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR)
            self.icon.set_from_pixbuf(scaled_buf)

            self.ing.bokken_sb.pack_end(gtk.Label('Bokken ' + version), False)
            self.ing.bokken_sb.pack_end(self.icon, False, False, 2)
            self.ing.bokken_sb.pack_end(gtk.VSeparator(), False)
Ejemplo n.º 16
0
    def __init__(self):
        gtk.Window.__init__(self)

        self.connect("destroy", self.terminar)

        hb = gtk.HBox()
        self.add(hb)

        self.left = Responsables()
        sep = gtk.VSeparator()
        self.right = Directory()

        hb.pack_start(self.left, expand=False)
        hb.pack_start(sep, expand=False)

        scrw = gtk.ScrolledWindow()
        scrw.add(self.right)

        hb.pack_start(scrw)

        self.show_all()
Ejemplo n.º 17
0
def add_row_cb(widget, data = None):
    hbox = gtk.HBox(gtk.FALSE, 0)

    entry = gtk.Entry(max = 0)
    entries.append(entry)
    hbox.pack_start(entry)
    hbox.pack_start(gtk.VSeparator(), gtk.FALSE, gtk.TRUE, 5)

    button = gtk.Button(stock = gtk.STOCK_ADD)
    button.connect('clicked', add_row_cb)
    hbox.pack_start(button)

    button = gtk.Button(stock = gtk.STOCK_REMOVE)
    if len(entries) > 1:
        button.connect('clicked', del_row_cb, hbox)
    else:
        button.set_sensitive(gtk.FALSE)
    hbox.pack_start(button)

    entrybox.pack_start(hbox, gtk.FALSE, gtk.FALSE, 2)
    hbox.show_all()
Ejemplo n.º 18
0
 def __init__(self):
     gtk.Window.__init__(self)
    
     self.connect("destroy", self.terminar)
    
     hb = gtk.HBox()
     self.add(hb)
    
     self.left = Responsables()
     self.left.columnas(("Fecha", "Tarea", "Respnsable"))
     hb.pack_start(self.left)
    
     sep = gtk.VSeparator()
     hb.pack_start(sep)
    
     self.right = Directory()
     self.right.columnas(("Archivo", "fecha"))
    
     hb.pack_start(self.right)
    
     self.show_all()
Ejemplo n.º 19
0
    def build_widget(self):
        button = gtk.Button()
        button.connect('clicked', self._on_open_button__clicked)

        box = gtk.HBox(False, 4)
        button.add(box)

        self._label = gtk.Label(self.no_attachment_lbl)
        self._label.set_ellipsize(pango.ELLIPSIZE_END)
        self._label.set_alignment(0.5, 0.5)
        box.pack_start(self._label, True, True, 0)

        self.image = gtk.Image()
        box.pack_end(self.image, False, False, 0)

        self.sep = gtk.VSeparator()
        box.pack_start(self.sep, False, False, 0)

        button.show_all()

        return button
Ejemplo n.º 20
0
 def __init__(self, heading, st_data, st):
     """
     st_data is the statistics data we want displayled
     st is the statistics object the statistics are collected from.
     """
     gtk.VBox.__init__(self)
     label = gtk.Label(heading)
     label.set_name("StatisticsH2")
     label.set_alignment(0.0, 0.0)
     self.pack_start(label, False)
     hbox = gu.bHBox(self, False)
     frame = gtk.Frame()
     hbox.pack_start(frame, False)
     t = gtk.Table()
     frame.add(t)
     keys = st.get_keys(True)
     for x in range(len(keys)):
         t.attach(gtk.VSeparator(), x * 2 + 1, x * 2 + 2, 0, len(keys) * 2)
     for x in range(len(keys) - 1):
         t.attach(gtk.HSeparator(), 0,
                  len(keys) * 2 + 1, x * 2 + 1, x * 2 + 2)
     for y, key in enumerate(keys):
         l = label_from_key(st, key)
         t.attach(l, 0, 1, y * 2, y * 2 + 1, xpadding=gu.PAD)
         for x, skey in enumerate(keys):
             try:
                 s = st_data[key][skey]
             except KeyError:
                 s = '-'
             l = gtk.Label(s)
             if x == y:
                 l.set_name('BoldText')
             t.attach(l,
                      x * 2 + 2,
                      x * 2 + 3,
                      y * 2,
                      y * 2 + 1,
                      xpadding=gu.PAD)
     self.show_all()
Ejemplo n.º 21
0
    def populate_widgets(self):
        self.vcsbar = gtk.EventBox()
        self.add(self.vcsbar, expand=False)

        vp = gtk.VPaned()
        self.add(vp)

        self.projects = ProjectTree(self.cb)
        self.projects.connect_select(self.cb_project_select)
        self.projects.connect_rightclick(self.cb_project_rclick)
        vp.pack1(self.projects.win, resize=True, shrink=True)

        self.files = FileTree(self.cb)
        self.files.pcb = self

        self.files.connect_activate(self.cb_files_activate)
        vp.pack2(self.files.win, resize=True, shrink=True)

        sep = gtk.VSeparator()
        self.cusbar.pack_start(sep, expand=False)

        self.add_button('new', self.cb_project_new,
                        'Add project to workbench.')
        self.add_button('editor', self.cb_project_edit,
                        'Edit projects on workbench.')

        self.dirmenu = gtkextra.ContextPopup(self.cb, 'dir')

        self.current_directory = os.getcwd()

        conffile = fn = self.cb.opts.get('files', 'project_data')

        self.config = ProjectRegistry(self.cb, conffile)
        self.config.load()
        self.projects.populate(self.config, self.current_directory)

        self.editor = None

        self.maps = create_vcs_maps(self.cb, self.cb_vcs_command)
Ejemplo n.º 22
0
    def __init__(self, entry, window, context=None, tabhistory=[], **kwargs):
        super(CompletionStatusDisplay, self).__init__(entry, window, **kwargs)
        self.__entry = entry
        self.__window = window
        self.__context = context
        self.__tabhistory = tabhistory
        self.__token = None
        self.__completer = None
        self.__complsys = CompletionSystem()
        self.__current_completion = None
        self.__current_history = None
        self.__pending_completion_load = False
        self.__completion_display = MatchPopup(
            _('Completions (%s)') % ('TAB', ), TabCompletionView, self.__entry,
            self.__window, self.__context)
        self.__completion_display.connect('item-selected',
                                          self.__on_completion_selected)
        self.__tab_history_display = MatchPopup(_('Tab History'),
                                                MatchingHistoryView,
                                                self.__entry, self.__window,
                                                self.__context)
        self.__tab_history_display.connect('item-selected',
                                           self.__on_histitem_selected)
        self.__global_history_display = MatchPopup(
            _('Global History Search (%s)') % ('Ctrl-R', ),
            MatchingHistoryView, self.__entry, self.__window, self.__context)
        self.__global_history_display.connect('item-selected',
                                              self.__on_histitem_selected)

        self.__overview_visible = False
        self.__completion_visible = False
        self.__tab_history_visible = False
        self.__global_history_visible = False

        self.get_box().pack_start(self.__completion_display.get_miniview(),
                                  expand=True)
        self.get_box().pack_start(gtk.VSeparator(), expand=False)
        self.get_box().pack_start(self.__global_history_display.get_miniview(),
                                  expand=True)
Ejemplo n.º 23
0
    def __init__(self, prefixes_str=""):
        """Generate the status bar."""
        super(StatusBarWidget, self).__init__()
        self.statusbar = gtk.VBox()
        hline = gtk.HSeparator()
        self.statusbar.pack_start(hline)
        hline.show()

        hbox = gtk.HBox()

        self.datasource_display = rose.gtk.util.AsyncLabel()
        self.datasource_display.set_text(prefixes_str)
        self.datasource_display.set_width_chars(len(prefixes_str))
        self.datasource_display.set_justify(gtk.JUSTIFY_CENTER)
        self.datasource_display.set_tooltip_text(
            rosie.browser.TIP_STATUSBAR_SOURCE)
        hbox.pack_start(self.datasource_display, expand=False, fill=False)
        self.datasource_display.show()
        vline = gtk.VSeparator()
        vline.show()
        hbox.pack_start(vline, expand=False, fill=False)

        self.statusbox = rose.gtk.util.AsyncLabel()
        x, y = self.statusbox.get_alignment()
        self.statusbox.set_alignment(0, y)
        hbox.pack_start(self.statusbox, expand=True, fill=True, padding=5)
        self.statusbox.show()
        self.progressbar = rose.gtk.util.ThreadedProgressBar(adjustment=None)
        self.statusbox.set_size_request(-1,
                                        self.progressbar.size_request()[1])
        hbox.pack_start(self.progressbar, expand=False, fill=False)
        #only show the progressbar when in use
        hbox.show()
        self.statusbar.pack_start(hbox, fill=True)
        self.statusbar.show()

        self.pack_start(self.statusbar, fill=True)
        self.show()
Ejemplo n.º 24
0
    def init_window(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("PaperShelf")
        self.window.set_border_width(10)
        self.window.connect("destroy", self.destroy)
        self.window.set_position(gtk.WIN_POS_CENTER)

        tags = self.stuff.settings.vars["visible_tags"]
        t = {}
        for i in tags.split(","):
            t[i] = True

        self.table = gtk.Table(rows=1, columns=1, homogeneous=True)
        self.table.set_col_spacings(10)
        self.table.show()
        self.fill_table(self.table, t)

        self.sc = gtk.ScrolledWindow()
        self.sc.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        self.sc.show()
        self.sc.add_with_viewport(self.table)

        # left bar
        self.left_bar = left_bar.LeftBar(self)

        h = gtk.HBox(False, 0)
        h.pack_start(self.left_bar, False, False, 0)
        sep = gtk.VSeparator()
        sep.show()
        h.pack_start(sep, False, False, 10)
        h.pack_start(self.sc, True, True, 0)
        h.show()

        self.window.resize(self.WIDTH, self.HEIGHT)
        self.window.add(h)
        self.window.show()

        self.sc.get_vadjustment().set_value(self.stuff.settings.vars["vpos"])
Ejemplo n.º 25
0
 def __init__(self, btApp, maggicPadding):
     gtk.Frame.__init__(self)
     #bottom row
     self.btApp = btApp
     row = gtk.HBox()
     self.dhtText = gtk.Label('')
     self.dhtText.set_markup('<span size="large">DHT Nodes:  0 (0)</span>')
     self.upText = gtk.Label('')
     initialInfos = (Format.bytes_per_second(0), Format.format_bytes(0))
     self.upText.set_markup('<span size="large">D: %s  %s</span>' %
                            initialInfos)
     self.downText = gtk.Label('')
     self.downText.set_markup('<span size="large">U: %s  %s</span>' %
                              initialInfos)
     self.creditText = gtk.Label('')
     self.creditText.set_markup(
         '<span size="large">Credits: Unknown</span>')
     for item in [self.dhtText, self.upText, self.downText]:
         row.pack_start(item, True, True, 0)
         row.pack_start(gtk.VSeparator(), False, False, 0)
     row.pack_start(self.creditText, True, True, 0)
     self.set_shadow_type(gtk.SHADOW_IN)
     self.add(row)
Ejemplo n.º 26
0
 def __init__(self, verbosity=rose.reporter.Reporter.DEFAULT):
     super(StatusBar, self).__init__()
     self.verbosity = verbosity
     self.num_errors = 0
     self.console = None
     hbox = gtk.HBox()
     hbox.show()
     self.pack_start(hbox, expand=False, fill=False)
     self._generate_error_widget()
     hbox.pack_start(self._error_widget, expand=False, fill=False)
     vsep_message = gtk.VSeparator()
     vsep_message.show()
     vsep_eb = gtk.EventBox()
     vsep_eb.show()
     hbox.pack_start(vsep_message, expand=False, fill=False)
     hbox.pack_start(vsep_eb, expand=True, fill=True)
     self._generate_message_widget()
     hbox.pack_end(self._message_widget,
                   expand=False,
                   fill=False,
                   padding=rose.config_editor.SPACING_SUB_PAGE)
     self.messages = []
     self.show()
Ejemplo n.º 27
0
    def __init__(self, window, parent, model, attrs={}):
        interface.widget_interface.__init__(self, window, parent, model, attrs)

        self.widget = gtk.VBox(homogeneous=False, spacing=1)

        hb = gtk.HBox(homogeneous=False, spacing=3)
        self.wid_text = gtk.Entry()
        self.wid_text.set_property('width_chars', 13)
        self.wid_text.connect('activate', self._sig_activate)
        self.wid_text.connect('populate-popup', self._menu_open)
        hb.pack_start(self.wid_text, expand=True, fill=True)

        hb.pack_start(gtk.VSeparator(), padding=2, expand=False, fill=False)

        self.wid_but_add = gtk.Button(stock='gtk-add')
        self.wid_but_add.set_relief(gtk.RELIEF_HALF)
        self.wid_but_add.set_focus_on_click(True)
        self.wid_but_add.connect('clicked', self._sig_add)
        hb.pack_start(self.wid_but_add, padding=3, expand=False, fill=False)

        self.wid_but_remove = gtk.Button(stock='gtk-remove')
        self.wid_but_remove.set_relief(gtk.RELIEF_HALF)
        self.wid_but_remove.set_focus_on_click(True)
        self.wid_but_remove.connect('clicked', self._sig_remove)
        hb.pack_start(self.wid_but_remove, expand=False, fill=False)

        hb.pack_start(gtk.VSeparator(), expand=False, fill=True)

        self.context = tools.expr_eval(attrs.get('context',"{}"))

        self.screen = Screen(attrs['relation'], view_type=['tree'],
                views_preload=attrs.get('views', {}),
                row_activate=self.row_activate,
                limit=pager.DEFAULT_LIMIT, context=self.context)
        self.screen.signal_connect(self, 'record-message', self._sig_label)
        self.screen.type = 'many2many'
        self.model = None
        self.model_field = None
        self.name = attrs['name']
        self.pager = pager(object=self, relation=attrs['relation'], screen=self.screen)

        # Button Previous Page
        self.eb_prev_page = self.pager.create_event_box(_('Previous Page'), self._sig_prev_page, 'gtk-goto-first')
        hb.pack_start(self.eb_prev_page, expand=False, fill=False)

        # Button Previous Record
        self.eb_pre = self.pager.create_event_box(_('Previous Record'), self._sig_previous, 'gtk-go-back')
        hb.pack_start(self.eb_pre, expand=False, fill=False)

        # Record display
        self.label = gtk.Label('(0,0)')
        hb.pack_start(self.label, expand=False, fill=False)

        # Button Next
        self.eb_next = self.pager.create_event_box(_('Next Record'), self._sig_next, 'gtk-go-forward')
        hb.pack_start(self.eb_next, expand=False, fill=False)

        # Button Next Page
        self.eb_next_page = self.pager.create_event_box(_('Next Page'), self._sig_next_page, 'gtk-goto-last')
        hb.pack_start(self.eb_next_page, expand=False, fill=False)

        hb.pack_start(gtk.VSeparator(), expand=False, fill=True)

        # LIMIT COMBO
        self.cb = self.pager.create_combo_box(_('Choose Limit'), self.limit_changed)
        hb.pack_start(self.cb, expand=False, fill=False)

        self.widget.pack_start(hb, expand=False, fill=False)
        self.widget.pack_start(gtk.HSeparator(), expand=False, fill=True)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.set_property('height-request', 200)
        scroll.set_placement(gtk.CORNER_TOP_LEFT)
        scroll.set_shadow_type(gtk.SHADOW_NONE)

        scroll.add_with_viewport(self.screen.widget)
        self.widget.pack_start(scroll, expand=True, fill=True)
Ejemplo n.º 28
0
    def __init__(self, view, attrs):
        super(One2Many, self).__init__(view, attrs)

        self.widget = gtk.Frame()
        self.widget.set_shadow_type(gtk.SHADOW_NONE)
        self.widget.get_accessible().set_name(attrs.get('string', ''))
        vbox = gtk.VBox(homogeneous=False, spacing=2)
        self.widget.add(vbox)
        self._readonly = True
        self._required = False
        self._position = 0
        self._length = 0

        self.title_box = hbox = gtk.HBox(homogeneous=False, spacing=0)
        hbox.set_border_width(2)

        self.title = gtk.Label(attrs.get('string', ''))
        self.title.set_alignment(0.0, 0.5)
        hbox.pack_start(self.title, expand=True, fill=True)

        hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)

        tooltips = common.Tooltips()

        self.focus_out = True
        self.wid_completion = None
        if attrs.get('add_remove'):

            self.wid_text = PlaceholderEntry()
            self.wid_text.set_placeholder_text(_('Search'))
            self.wid_text.set_property('width_chars', 13)
            self.wid_text.connect('focus-out-event',
                                  lambda *a: self._focus_out())
            hbox.pack_start(self.wid_text, expand=True, fill=True)

            if int(self.attrs.get('completion', 1)):
                access = common.MODELACCESS[attrs['relation']]
                self.wid_completion = get_completion(
                    search=access['read'] and access['write'],
                    create=attrs.get('create', True) and access['create'])
                self.wid_completion.connect('match-selected',
                                            self._completion_match_selected)
                self.wid_completion.connect('action-activated',
                                            self._completion_action_activated)
                self.wid_text.set_completion(self.wid_completion)
                self.wid_text.connect('changed', self._update_completion)

            self.but_add = gtk.Button()
            tooltips.set_tip(self.but_add, _('Add existing record'))
            self.but_add.connect('clicked', self._sig_add)
            img_add = gtk.Image()
            img_add.set_from_stock('tryton-list-add',
                                   gtk.ICON_SIZE_SMALL_TOOLBAR)
            img_add.set_alignment(0.5, 0.5)
            self.but_add.add(img_add)
            self.but_add.set_relief(gtk.RELIEF_NONE)
            hbox.pack_start(self.but_add, expand=False, fill=False)

            self.but_remove = gtk.Button()
            tooltips.set_tip(self.but_remove, _('Remove selected record'))
            self.but_remove.connect('clicked', self._sig_remove, True)
            img_remove = gtk.Image()
            img_remove.set_from_stock('tryton-list-remove',
                                      gtk.ICON_SIZE_SMALL_TOOLBAR)
            img_remove.set_alignment(0.5, 0.5)
            self.but_remove.add(img_remove)
            self.but_remove.set_relief(gtk.RELIEF_NONE)
            hbox.pack_start(self.but_remove, expand=False, fill=False)

            hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)

        self.but_new = gtk.Button()
        tooltips.set_tip(self.but_new, _('Create a new record <F3>'))
        self.but_new.connect('clicked', self._sig_new)
        img_new = gtk.Image()
        img_new.set_from_stock('tryton-new', gtk.ICON_SIZE_SMALL_TOOLBAR)
        img_new.set_alignment(0.5, 0.5)
        self.but_new.add(img_new)
        self.but_new.set_relief(gtk.RELIEF_NONE)
        hbox.pack_start(self.but_new, expand=False, fill=False)

        self.but_open = gtk.Button()
        tooltips.set_tip(self.but_open, _('Edit selected record <F2>'))
        self.but_open.connect('clicked', self._sig_edit)
        img_open = gtk.Image()
        img_open.set_from_stock('tryton-open', gtk.ICON_SIZE_SMALL_TOOLBAR)
        img_open.set_alignment(0.5, 0.5)
        self.but_open.add(img_open)
        self.but_open.set_relief(gtk.RELIEF_NONE)
        hbox.pack_start(self.but_open, expand=False, fill=False)

        self.but_del = gtk.Button()
        tooltips.set_tip(self.but_del, _('Delete selected record <Del>'))
        self.but_del.connect('clicked', self._sig_remove, False)
        img_del = gtk.Image()
        img_del.set_from_stock('tryton-delete', gtk.ICON_SIZE_SMALL_TOOLBAR)
        img_del.set_alignment(0.5, 0.5)
        self.but_del.add(img_del)
        self.but_del.set_relief(gtk.RELIEF_NONE)
        hbox.pack_start(self.but_del, expand=False, fill=False)

        self.but_undel = gtk.Button()
        tooltips.set_tip(self.but_undel, _('Undelete selected record <Ins>'))
        self.but_undel.connect('clicked', self._sig_undelete)
        img_undel = gtk.Image()
        img_undel.set_from_stock('tryton-undo', gtk.ICON_SIZE_SMALL_TOOLBAR)
        img_undel.set_alignment(0.5, 0.5)
        self.but_undel.add(img_undel)
        self.but_undel.set_relief(gtk.RELIEF_NONE)
        hbox.pack_start(self.but_undel, expand=False, fill=False)

        hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)

        self.but_pre = gtk.Button()
        tooltips.set_tip(self.but_pre, _('Previous'))
        self.but_pre.connect('clicked', self._sig_previous)
        img_pre = gtk.Image()
        img_pre.set_from_stock('tryton-go-previous',
                               gtk.ICON_SIZE_SMALL_TOOLBAR)
        img_pre.set_alignment(0.5, 0.5)
        self.but_pre.add(img_pre)
        self.but_pre.set_relief(gtk.RELIEF_NONE)
        hbox.pack_start(self.but_pre, expand=False, fill=False)

        self.label = gtk.Label('(0,0)')
        hbox.pack_start(self.label, expand=False, fill=False)

        self.but_next = gtk.Button()
        tooltips.set_tip(self.but_next, _('Next'))
        self.but_next.connect('clicked', self._sig_next)
        img_next = gtk.Image()
        img_next.set_from_stock('tryton-go-next', gtk.ICON_SIZE_SMALL_TOOLBAR)
        img_next.set_alignment(0.5, 0.5)
        self.but_next.add(img_next)
        self.but_next.set_relief(gtk.RELIEF_NONE)
        hbox.pack_start(self.but_next, expand=False, fill=False)

        hbox.pack_start(gtk.VSeparator(), expand=False, fill=True)

        but_switch = gtk.Button()
        tooltips.set_tip(but_switch, _('Switch'))
        but_switch.connect('clicked', self.switch_view)
        img_switch = gtk.Image()
        img_switch.set_from_stock('tryton-fullscreen',
                                  gtk.ICON_SIZE_SMALL_TOOLBAR)
        img_switch.set_alignment(0.5, 0.5)
        but_switch.add(img_switch)
        but_switch.set_relief(gtk.RELIEF_NONE)
        hbox.pack_start(but_switch, expand=False, fill=False)

        if attrs.get('add_remove'):
            hbox.set_focus_chain([self.wid_text])
        else:
            hbox.set_focus_chain([])

        tooltips.enable()

        frame = gtk.Frame()
        frame.add(hbox)
        frame.set_shadow_type(gtk.SHADOW_OUT)
        vbox.pack_start(frame, expand=False, fill=True)

        self.screen = Screen(attrs['relation'],
                             mode=attrs.get('mode', 'tree,form').split(','),
                             view_ids=attrs.get('view_ids', '').split(','),
                             views_preload=attrs.get('views', {}),
                             row_activate=self._on_activate,
                             exclude_field=attrs.get('relation_field', None))
        self.screen.pre_validate = bool(int(attrs.get('pre_validate', 0)))
        self.screen.signal_connect(self, 'record-message', self._sig_label)

        vbox.pack_start(self.screen.widget, expand=True, fill=True)

        self.screen.widget.connect('key_press_event', self.on_keypress)
        if self.attrs.get('add_remove'):
            self.wid_text.connect('key_press_event', self.on_keypress)

        but_switch.props.sensitive = self.screen.number_of_views > 1
Ejemplo n.º 29
0
    def create_toolbar(self, dataset, report, search, filter, help):
        self.toolbar = gtk.Toolbar()

        # Dataset widgets
        if dataset == True:
            self.button_new = Buttons.Simple().create(
                stock_image=gtk.STOCK_NEW, height=32)
            self.button_new.connect('clicked', self.on_button_new_clicked)
            self.toolbar.add(self.button_new)
            self.button_edit = Buttons.Simple().create(
                stock_image=gtk.STOCK_EDIT, height=32)
            self.button_edit.connect('clicked', self.on_button_edit_clicked)
            self.button_edit.set_sensitive(0)
            self.toolbar.add(self.button_edit)
            self.button_delete = Buttons.Simple().create(
                stock_image=gtk.STOCK_DELETE, height=32)
            self.button_delete.connect('clicked',
                                       self.on_button_delete_clicked)
            self.button_delete.set_sensitive(0)
            self.toolbar.add(self.button_delete)
            separator = gtk.VSeparator()
            separator.set_size_request(8, 32)
            self.toolbar.add(separator)

        # Report widgets
        if report == True:
            self.button_print = Buttons.Simple().create(
                stock_image=gtk.STOCK_PRINT, height=32)
            self.button_print.connect('clicked', self.on_button_print_clicked)
            self.toolbar.add(self.button_print)
            separator = gtk.VSeparator()
            separator.set_size_request(8, 32)
            self.toolbar.add(separator)

        # Search widgets
        if search == True:
            self.entry_search = gtk.Entry()
            self.entry_search.set_size_request(200, 24)
            self.toolbar.add(self.entry_search)
            self.button_search = Buttons.Simple().create(
                stock_image=gtk.STOCK_FIND, height=32)
            self.button_search.connect('clicked',
                                       self.on_button_search_clicked)
            self.toolbar.add(self.button_search)
            separator = gtk.VSeparator()
            separator.set_size_request(8, 32)
            self.toolbar.add(separator)

        # Filter widgets
        if filter == True:
            self.comboboxentry_filter = gtk.ComboBoxEntry()
            self.comboboxentry_filter.set_size_request(200, 24)
            vbox = gtk.VBox()
            vbox.pack_start(gtk.Fixed(), expand=True, fill=True, padding=0)
            vbox.pack_start(self.comboboxentry_filter,
                            expand=False,
                            fill=False,
                            padding=0)
            vbox.pack_start(gtk.Fixed(), expand=True, fill=True, padding=0)
            self.toolbar.add(vbox)
            separator = gtk.VSeparator()
            separator.set_size_request(8, 32)
            self.toolbar.add(separator)

        if help == True:
            self.button_help = Buttons.Simple().create(
                stock_image=gtk.STOCK_HELP, width=-1, height=32)
            self.button_help.connect('clicked', self.on_button_help_clicked)
            self.toolbar.add(self.button_help)

        self.toolbar.show_all()
Ejemplo n.º 30
0
def main_window():
    """ main window (display) """
    def delete_event(widget, event, data=None):
        """ Delete Event """
        return False

    def destroy(widget, data=None):
        """ Detroy """
        gtk.main_quit()

    #Event Callbacks
    def event_simple_cb(widget, event, data):
        """ general event callback function """
        if data == "para":
            (cmd1, cmd2) = akkupara_dialog()
            if not cmd1:
                return

            cfg.COMMAND_ABORT = False  #reset

            helper.akkumatik_command(cmd1, "Übertragen")
            cfg.FLOG.write("Sending Command %s \"Übertragen\"\n" % cmd1)

            if cmd2:
                time.sleep(0.6)  #else threads may get out of order somehow
                helper.akkumatik_command(cmd2, "Start")
                cfg.FLOG.write("Sending Command %s \"Start\"\n" % cmd2)
        elif data == "chart":
            ra_gnuplot.gnuplot()
            #ra_matplot.matplot()
        elif data == "recycle":
            cfg.FILE_BLOCK = True  #stop reading in files (read_line)
            cfg.FSER.close()
            #truncates old file
            cfg.FSER = helper.open_file(cfg.TMP_DIR + '/serial-akkumatik.dat',
                                        'w+b')
            cfg.FLOG.write("%s opened (new or create binary)" % \
                    cfg.TMP_DIR + '/serial-akkumatik.dat\n')
            cfg.FILE_BLOCK = False
            message_dialog(cfg.GTK_WINDOW,
                           "Alte serielle Daten wurden geloescht.")
            return

        elif data == "quit":
            gtk.main_quit()

    def event_simple_enter_cb(widget, event, data):
        """ general event enter function """
        widget.get_child().set_from_file(cfg.EXE_DIR + \
                "/bilder/"+data+"_hover.png")

    def event_simple_leave_cb(widget, event, data):
        """ general event leave function """
        widget.get_child().set_from_file(cfg.EXE_DIR + "/bilder/" + data +
                                         ".png")

    #AKKU OUTPUT Callbacks
    def eventcb(widget, event, data):
        """ callback function - eventboxes containing Akku-Ausgang pics """

        #True later on generate_output_strs() again
        cfg.START_STOP.set_sensitive(False)

        if data == "1":
            cfg.IMG_AKKU1.set_from_file(cfg.EXE_DIR + "/bilder/Ausgang.png")
            cfg.IMG_AKKU2.set_from_file(cfg.EXE_DIR +
                                        "/bilder/Ausgang_off.png")
            cfg.GEWAEHLTER_AUSGANG = 1
        else:
            cfg.IMG_AKKU2.set_from_file(cfg.EXE_DIR + "/bilder/Ausgang.png")
            cfg.IMG_AKKU1.set_from_file(cfg.EXE_DIR +
                                        "/bilder/Ausgang_off.png")
            cfg.GEWAEHLTER_AUSGANG = 2

    def event_enter_cb(widget, event, data):
        """ hover effect - hover when _off """
        if data == "1":
            if cfg.GEWAEHLTER_AUSGANG == 2:
                cfg.IMG_AKKU1.set_from_file(cfg.EXE_DIR + \
                        "/bilder/Ausgang_hover.png")
        else:
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.IMG_AKKU2.set_from_file(cfg.EXE_DIR + \
                        "/bilder/Ausgang_hover.png")

    def event_leave_cb(widget, event, data):
        """ hover effect 2 - reset """
        if data == "1":
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.IMG_AKKU1.set_from_file(cfg.EXE_DIR +
                                            "/bilder/Ausgang.png")
            else:
                cfg.IMG_AKKU1.set_from_file(cfg.EXE_DIR +
                                            "/bilder/Ausgang_off.png")
        else:
            if cfg.GEWAEHLTER_AUSGANG == 2:
                cfg.IMG_AKKU2.set_from_file(cfg.EXE_DIR +
                                            "/bilder/Ausgang.png")
            else:
                cfg.IMG_AKKU2.set_from_file(cfg.EXE_DIR +
                                            "/bilder/Ausgang_off.png")

    #START/STOP callbacks
    def event_start_stop_cb(widget, event, data):
        """ callback function - eventboxes containing START/STOP pics """

        if not cfg.START_STOP.get_sensitive():
            return

        #True later on generate_output_strs() again
        cfg.START_STOP.set_sensitive(False)

        #not running -> send start
        if cfg.PHASE == 0:
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("44", "Start")
                cfg.FLOG.write("Sending Command 44\n")
            else:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("48", "Start")
                cfg.FLOG.write("Sending Command 48\n")
        else:  #running -> send stop
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("41", "Stop")
                cfg.FLOG.write("Sending Command 41\n")
            else:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("42", "Stop")
                cfg.FLOG.write("Sending Command 42\n")

    def event_start_stop_enter_cb(widget, event, data):
        """ enter event on start-stop button """
        cfg.START_STOP_HOVER = True
        if cfg.PHASE == 0:
            cfg.START_STOP.set_from_file(cfg.EXE_DIR +
                                         "/bilder/start_hover.png")
        else:
            cfg.START_STOP.set_from_file(cfg.EXE_DIR +
                                         "/bilder/stop_hover.png")

    def event_start_stop_leave_cb(widget, event, data):
        """ leave event on start-stop button """
        cfg.START_STOP_HOVER = False

        if cfg.PHASE == 0:
            cfg.START_STOP.set_from_file(cfg.EXE_DIR + "/bilder/start.png")
        else:
            cfg.START_STOP.set_from_file(cfg.EXE_DIR + "/bilder/stop.png")

    #def draw_pixbuf(widget, event):
    #""" add the picture to the window """
    #path = cfg.EXE_DIR + '/bilder/Display.png'
    #pixbuf = gtk.gdk.pixbuf_new_from_file(path)
    #widget.window.draw_pixbuf(widget.style.bg_gc[gtk.STATE_NORMAL], \
    #pixbuf, 0, 0, 0,0)

    cfg.GTK_WINDOW = gtk.Window(gtk.WINDOW_TOPLEVEL)
    cfg.GTK_WINDOW.set_title('Akkumatic Remote Display')
    cfg.GTK_WINDOW.set_size_request(917, 168)
    cfg.GTK_WINDOW.set_default_size(917, 168)
    cfg.GTK_WINDOW.set_position(gtk.WIN_POS_CENTER)

    cfg.GTK_WINDOW.connect("delete_event", delete_event)
    cfg.GTK_WINDOW.connect("destroy", destroy)
    cfg.GTK_WINDOW.set_border_width(8)

    # overall hbox
    hbox = gtk.HBox()
    cfg.GTK_WINDOW.add(hbox)
    hbox.connect('expose-event', helper.draw_pixbuf, \
            cfg.EXE_DIR + '/bilder/Display.png')

    # akkumatik display label
    gfixed = gtk.Fixed()
    hbox.pack_start(gfixed, True, True, 0)

    #Left part of display
    cfg.LABEL1 = gtk.Label()
    cfg.LABEL1.set_size_request(342, 92)
    cfg.LABEL1.set_alignment(0, 0)
    cfg.LABEL1.set_justify(gtk.JUSTIFY_LEFT)
    if platform.system() == "Windows":
        cfg.LABEL1.modify_font(pango.FontDescription("mono bold 25"))
        gfixed.put(cfg.LABEL1, 45, 40)
    else:
        cfg.LABEL1.modify_font(pango.FontDescription("mono 22"))
        gfixed.put(cfg.LABEL1, 45, 36)

    #Right part of display
    cfg.LABEL2 = gtk.Label()
    cfg.LABEL2.set_size_request(340, 100)
    cfg.LABEL2.set_alignment(0, 0)
    cfg.LABEL2.set_justify(gtk.JUSTIFY_LEFT)
    if platform.system() == "Windows":
        gfixed.put(cfg.LABEL2, 418, 33)
        cfg.LABEL2.modify_font(pango.FontDescription("mono bold 14"))
    else:
        cfg.LABEL2.modify_font(pango.FontDescription("mono 12"))
        gfixed.put(cfg.LABEL2, 418, 33)

    #Status of display
    cfg.LABEL_STATUS = gtk.Label()
    cfg.LABEL_STATUS.set_size_request(729, 22)
    cfg.LABEL_STATUS.set_alignment(0, 0)
    cfg.LABEL_STATUS.set_justify(gtk.JUSTIFY_LEFT)

    cfg.EVENT_BOX_LSTATUS = gtk.EventBox()
    cfg.EVENT_BOX_LSTATUS.set_visible_window(True)
    cfg.EVENT_BOX_LSTATUS.add(cfg.LABEL_STATUS)
    cfg.EVENT_BOX_LSTATUS.modify_bg(gtk.STATE_NORMAL, \
            cfg.EVENT_BOX_LSTATUS.get_colormap().alloc_color("#aaaaaa"))

    gfixed.put(cfg.EVENT_BOX_LSTATUS, 34, 136)
    if platform.system() == "Windows":
        cfg.LABEL_STATUS.modify_font(pango.FontDescription("mono bold 14"))
    else:
        cfg.LABEL_STATUS.modify_font(pango.FontDescription("mono bold 12"))

    #vbox for buttons
    vbox = gtk.VBox()
    hbox.pack_end(vbox, False, False, 0)

    # hbox for Akku1+2 and start/stop
    hbox = gtk.HBox()
    vbox.pack_start(hbox, False, False, 0)

    #AKKU1
    evbox = gtk.EventBox()
    evbox.set_visible_window(False)
    cfg.IMG_AKKU1 = gtk.Image()
    cfg.IMG_AKKU1.set_size_request(20, 48)
    evbox.add(cfg.IMG_AKKU1)
    evbox.connect("button-press-event", eventcb, "1")
    #hover effect
    evbox.connect("enter-notify-event", event_enter_cb, "1")
    evbox.connect("leave-notify-event", event_leave_cb, "1")
    if cfg.TOOLTIPS:
        evbox.set_tooltip_text("Akku Ausgang 1")
    hbox.pack_start(evbox, False, False, 0)

    #START/STOP
    evbox = gtk.EventBox()
    evbox.set_visible_window(False)
    cfg.START_STOP = gtk.Image()
    cfg.START_STOP.set_from_file(cfg.EXE_DIR + "/bilder/start.png")
    cfg.START_STOP.set_sensitive(False)
    evbox.add(cfg.START_STOP)
    evbox.connect("button-press-event", event_start_stop_cb, "StartStop")
    evbox.connect("enter-notify-event", event_start_stop_enter_cb, "StartStop")
    evbox.connect("leave-notify-event", event_start_stop_leave_cb, "StartStop")
    if cfg.TOOLTIPS:
        evbox.set_tooltip_text("Start/Stop")
    hbox.pack_start(evbox, True, True, 2)

    #AKKU2
    evbox = gtk.EventBox()
    evbox.set_visible_window(False)
    cfg.IMG_AKKU2 = gtk.Image()
    cfg.IMG_AKKU2.set_size_request(20, 48)
    evbox.add(cfg.IMG_AKKU2)
    evbox.connect("button-press-event", eventcb, "2")
    evbox.connect("enter-notify-event", event_enter_cb, "2")
    evbox.connect("leave-notify-event", event_leave_cb, "2")
    if cfg.TOOLTIPS:
        evbox.set_tooltip_text("Akku Ausgang 2")
    hbox.pack_end(evbox, False, False, 0)

    if cfg.GEWAEHLTER_AUSGANG == 1:
        cfg.IMG_AKKU2.set_from_file(cfg.EXE_DIR + "/bilder/Ausgang_off.png")
        cfg.IMG_AKKU1.set_from_file(cfg.EXE_DIR + "/bilder/Ausgang.png")
    else:
        cfg.IMG_AKKU1.set_from_file(cfg.EXE_DIR + "/bilder/Ausgang_off.png")
        cfg.IMG_AKKU2.set_from_file(cfg.EXE_DIR + "/bilder/Ausgang.png")

    vbox.pack_start(gtk.HSeparator(), False, False, 8)

    #hbox fuer 'parameter,chart'
    hbox = gtk.HBox()
    vbox.pack_start(hbox, False, False, 0)

    #para
    evbox = gtk.EventBox()
    evbox.set_visible_window(False)
    image = gtk.Image()
    image.set_from_file(cfg.EXE_DIR + "/bilder/para.png")
    image.set_size_request(55, 42)
    evbox.add(image)
    evbox.connect("button-press-event", event_simple_cb, "para")
    evbox.connect("enter-notify-event", event_simple_enter_cb, "para")
    evbox.connect("leave-notify-event", event_simple_leave_cb, "para")
    if cfg.TOOLTIPS:
        evbox.set_tooltip_text("Akku Parameter")
    hbox.pack_start(evbox, False, False, 0)

    #chart
    evbox = gtk.EventBox()
    evbox.set_visible_window(False)
    image = gtk.Image()
    image.set_from_file(cfg.EXE_DIR + "/bilder/chart.png")
    image.set_size_request(42, 42)
    evbox.add(image)
    evbox.connect("button-press-event", event_simple_cb, "chart")
    evbox.connect("enter-notify-event", event_simple_enter_cb, "chart")
    evbox.connect("leave-notify-event", event_simple_leave_cb, "chart")
    if cfg.TOOLTIPS:
        evbox.set_tooltip_text("Chart(s)")
    hbox.pack_end(evbox, False, False, 0)

    vbox.pack_start(gtk.HSeparator(), False, True, 8)

    #hbox fuer 'data stuff'
    hbox = gtk.HBox()
    vbox.pack_start(hbox, False, False, 0)

    #recycle
    evbox = gtk.EventBox()
    evbox.set_visible_window(False)
    image = gtk.Image()
    image.set_from_file(cfg.EXE_DIR + "/bilder/recycle.png")
    #image.set_size_request(28, 20)
    evbox.add(image)
    evbox.connect("button-press-event", event_simple_cb, "recycle")
    evbox.connect("enter-notify-event", event_simple_enter_cb, "recycle")
    evbox.connect("leave-notify-event", event_simple_leave_cb, "recycle")
    if cfg.TOOLTIPS:
        evbox.set_tooltip_text("Alte Daten löschen")
    hbox.pack_start(evbox, True, True, 0)

    evbox = gtk.EventBox()
    evbox.set_visible_window(False)
    image = gtk.Image()
    image.set_from_file(cfg.EXE_DIR + "/bilder/quit.png")
    image.set_size_request(38, 30)
    evbox.add(image)
    evbox.connect("button-press-event", event_simple_cb, "quit")
    evbox.connect("enter-notify-event", event_simple_enter_cb, "quit")
    evbox.connect("leave-notify-event", event_simple_leave_cb, "quit")
    if cfg.TOOLTIPS:
        evbox.set_tooltip_text("Programm verlassen")
    hbox.pack_end(evbox, False, True, 0)

    hbox.pack_end(gtk.VSeparator(), False, True, 2)

    vbox.pack_start(gtk.HSeparator(), False, True, 8)

    # after file-open (what is needed on plotting)... hm?
    cfg.GTK_WINDOW.show_all()
    cfg.LABEL_STATUS.hide()

    return