Example #1
0
    def drawProof(self):
        self.proofBox.delete_all()

        numberStyle = tix.DisplayStyle(tix.TEXT,
                                       refwindow=self.proofBox,
                                       padx=10,
                                       anchor=tix.E)
        propStyle = tix.DisplayStyle(tix.TEXT, refwindow=self.proofBox)

        # Draw the Proof Steps
        num = None
        for num, step in enumerate(self.proof):
            s = ProofWidget.indentString(step.level, step.prop)
            self.proofBox.add(str(num),
                              itemtype=tix.TEXT,
                              text=str(num + 1) + '.',
                              style=numberStyle)
            self.proofBox.item_create(str(num),
                                      1,
                                      itemtype=tix.TEXT,
                                      text=s,
                                      style=propStyle)
            self.proofBox.item_create(str(num),
                                      2,
                                      itemtype=tix.TEXT,
                                      text=step.justificationString(),
                                      style=propStyle)

        # Draw the 'Ghost' next step
        ghostStyle = tix.DisplayStyle(tix.TEXT, refwindow=self.proofBox)

        if num is None:
            num = 0
        else:
            num += 1

        s = ProofWidget.indentString(self.proof.currentLevel(), '__')
        self.proofBox.add(str(num),
                          itemtype=tix.TEXT,
                          text=str(num + 1) + '.',
                          style=numberStyle)
        self.proofBox.item_create(str(num),
                                  1,
                                  itemtype=tix.TEXT,
                                  text=s,
                                  style=propStyle)
        self.proofBox.item_create(str(num),
                                  2,
                                  itemtype=tix.TEXT,
                                  text='',
                                  style=propStyle)

        # Indicate the selections
        for entry in self._selectionList:
            if entry[1]:
                if isinstance(entry[0], int):
                    self.proofBox.selection_set(entry[0] - 1)
                elif isinstance(entry[0], tuple):
                    for idx in range(entry[0][0] - 1, entry[0][1]):
                        self.proofBox.selection_set(idx)
Example #2
0
    def __init__(self, master, **ops):
        """Initialize a new instance of the class.
      Category:      Mutator.
      Returns:       Nothing.
      Side Effects:  Initializes an instance.
      Preconditions: [AssertionError] set must be a list or None.
      """
        tix.ScrolledHList.__init__(
            self,
            master,
            options='hlist.columns 4 hlist.header 1 selectMode single',
            **ops)

        self.proofBox = self.hlist

        self.proofBox.bind('<ButtonRelease-1>', self.onEntryClicked)

        # Create the title for the HList widget
        #       >> Notice that we have set the hlist.header subwidget option to true
        #      so that the header is displayed
        #boldfont=self.proofBox.tk.call('tix','option','get','boldfont')

        # Create the headers for the proof
        stepNumHeaderStyle = tix.DisplayStyle(tix.TEXT,
                                              refwindow=self.proofBox,
                                              anchor=tix.CENTER,
                                              padx=8,
                                              pady=2)  #, font=boldfont )
        propHeaderStyle = tix.DisplayStyle(tix.TEXT,
                                           refwindow=self.proofBox,
                                           anchor=tix.CENTER,
                                           padx=80,
                                           pady=2)  #, font=boldfont )
        reasonHeaderStyle = tix.DisplayStyle(tix.TEXT,
                                             refwindow=self.proofBox,
                                             anchor=tix.CENTER,
                                             padx=10,
                                             pady=2)  #, font=boldfont )

        self.proofBox.header_create(0,
                                    itemtype=tix.TEXT,
                                    text='',
                                    style=stepNumHeaderStyle)
        self.proofBox.header_create(1,
                                    itemtype=tix.TEXT,
                                    text='Step',
                                    style=propHeaderStyle)
        self.proofBox.header_create(2,
                                    itemtype=tix.TEXT,
                                    text='Reason',
                                    style=reasonHeaderStyle)

        self.proofBox.column_width(0, chars=8)

        self.proofBox.column_width(3, 0)

        self._selectionList = []
        self._proof = Proof()
Example #3
0
 def crtChkLstItms(self, itmCllctn, ifRadio = False):
     self.txtWdgtDelete(False)
     self._selctdItemsLst_.clear()
     [wdg.destroy() for wdg in self.frOutRslts.subwidgets_all() if (isinstance(wdg, tk.CheckList))]
         #self.dctItmsChkLst.destroy()
     
     ## Список чекбоксов для вывода в текстовом окне
     self.dctItmsChkLst = tk.CheckList(self.frOutRslts, radio = ifRadio)
     ##
     self.jmscdObj.setEntity(self.entStrVar.get())
     indx = 1.0
     ##
     self.dctItmsVar = tk.BooleanVar()
     self.dctItmsVar.set(not ifRadio)
     tmpChkLst = self.getSubWgts(self.dctItmsChkLst, tk._dummyHList)
     self.styles["new"] = tk.DisplayStyle(itemtype = tk.IMAGETEXT, refwindow = tmpChkLst)
     self.styles["edited"] = tk.DisplayStyle(itemtype = tk.IMAGETEXT, refwindow = tmpChkLst, fg = '#CC4125')
     self.styles["inProgress"] = tk.DisplayStyle(itemtype = tk.IMAGETEXT, refwindow = tmpChkLst, fg = '#38761D')
     if (self.jmscdObj.platf.startswith('linux')):
         widthFrInSymb = int(self.tstOutText.winfo_width() / 7 - 3)
     elif (self.jmscdObj.platf.startswith('win')):
         widthFrInSymb = int(self.tstOutText.winfo_width() / 6 - 4)
     else:
         widthFrInSymb = int(self.tstOutText.winfo_width() / 7 - 3)
     heightTstInSymb = int(round(self.tstOutText.cget("height") / 2, 0))
     tmpChkLst.config(header = True, width = widthFrInSymb, height = heightTstInSymb, borderwidth=1)            
     tmpChkLst.header_create(col = 0, itemtype = tk.TEXT, text = self.jmscdObj._selctdKey_)
     self.chkBtnTst = tk.Checkbutton(tmpChkLst, command = self.testCmd, variable = self.dctItmsVar)
     self.chkBtnTst.config(text = "Авто выбор/Все знач.")
     tmpChkLst.add('dctItm_0', itemtype = tk.WINDOW, window = self.chkBtnTst)
     entrCnt = 0
     for lnNum in range(len(itmCllctn)):
         if not (isinstance(itmCllctn[lnNum], tuple)):
             entrCnt += 1
             entrTxt = itmCllctn[lnNum]
             entrVal = itmCllctn[lnNum]
             self.chkLstAdd(tmpChkLst, entrCnt, entrTxt, entrVal)
         else:
             for entr in itmCllctn[lnNum][1]:
                 entrCnt += 1
                 tmpVar = entr[:2] if isinstance(entr, tuple) else entr
                 entrTxt = (itmCllctn[lnNum][0] + ': ' + str(tmpVar))
                 entrVal = (itmCllctn[lnNum][0], ((entr),))
                 self.chkLstAdd(tmpChkLst, entrCnt, entrTxt, entrVal)
     self.tstOutText.window_create(tk.END, window = self.dctItmsChkLst, align = tk.TOP)
     tmpIfMode = 'off' if (ifRadio) else 'on'
     for i in tmpChkLst.info_children():
         self.dctItmsChkLst.setstatus(i, mode=tmpIfMode)
     self.tstOutText.config(state = tk.DISABLED)
     del tmpChkLst
     del tmpIfMode
     self.logger.info("Checklist of dictionary entries created in Text Widget")
     return 0
Example #4
0
    def __init__(self, locale_json, shlist):
        # init
        self.shlist = shlist
        self.hlist = shlist.subwidget("hlist")
        hlist.config(command=self.on_item_picked)

        # init styles
        self.default_style = tk.DisplayStyle(tk.IMAGETEXT,
                                             fg="black",
                                             refwindow=self.hlist)
        self.changed_style = tk.DisplayStyle(tk.IMAGETEXT,
                                             fg="green",
                                             selectbackground="gray",
                                             refwindow=self.hlist)
        self.resolving_style = tk.DisplayStyle(tk.IMAGETEXT,
                                               bg="orange",
                                               selectbackground="gray",
                                               refwindow=self.hlist)
        self.found_style = tk.DisplayStyle(tk.IMAGETEXT,
                                           fg="black",
                                           bg="#92FF92",
                                           selectbackground="#92FF92",
                                           refwindow=self.hlist)
        self.found_single_style = tk.DisplayStyle(tk.IMAGETEXT,
                                                  bg="#008000",
                                                  selectbackground="#008000",
                                                  refwindow=self.hlist)

        # json & lists
        self.locale_json = locale_json
        simplified_json = {}
        for json_file in locale_json["files"]:
            simplified_json[json_file] = locale_json["files"][json_file][
                "dict"]
        self.fix_json = {}

        # add groups to list
        self.main_group = GroupItem(0, "files", simplified_json, 0)
        self.add_to_list(self.main_group.items)

        # notify list
        self.shlist.autosetmode()
        self.close_groups()
Example #5
0
 def update(self, ruleList):
     ruleStyle = tix.DisplayStyle(tix.TEXT,
                                  refwindow=self,
                                  padx=10,
                                  anchor=tix.W)
     for rule in ruleList:
         self.ruleBox.add(rule.name,
                          itemtype=tix.TEXT,
                          text=rule.name,
                          style=ruleStyle)
         self.ruleBox.item_create(rule.name,
                                  1,
                                  itemtype=tix.TEXT,
                                  text=rule.abbrev)
         self.ruleBox.item_create(rule.name,
                                  2,
                                  itemtype=tix.TEXT,
                                  text=rule.sequent)
Example #6
0
    def __init__(self, master, **ops):
        """Initialize a new instance of the class.
      Category:      Mutator.
      Returns:       Nothing.
      Side Effects:  Initializes an instance.
      Preconditions: [AssertionError] set must be a list or None.
      """
        tix.ScrolledHList.__init__(
            self,
            master,
            options='hlist.columns 4 hlist.header 1 selectMode single',
            **ops)
        self.ruleBox = self.hlist

        #boldfont=self.ruleBox.tk.call('tix','option','get','bold_font')

        # Create the headers for Rule List
        ruleNameHeaderStyle = tix.DisplayStyle(tix.TEXT,
                                               refwindow=self.ruleBox,
                                               anchor=tix.CENTER,
                                               padx=10,
                                               pady=2)  #, font=boldfont )

        self.ruleBox.header_create(0,
                                   itemtype=tix.TEXT,
                                   text='Rule Name',
                                   style=ruleNameHeaderStyle)
        self.ruleBox.header_create(1,
                                   itemtype=tix.TEXT,
                                   text='Abbrev',
                                   style=ruleNameHeaderStyle)
        self.ruleBox.header_create(2,
                                   itemtype=tix.TEXT,
                                   text='Sequent',
                                   style=ruleNameHeaderStyle)

        self.ruleBox.column_width(3, 0)